flyrain commented on code in PR #1261:
URL: https://github.com/apache/polaris/pull/1261#discussion_r2017286462


##########
polaris-core/src/main/java/org/apache/polaris/core/policy/validator/maintenance/SnapshotRetentionPolicyValidator.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.core.policy.validator.maintenance;
+
+import 
org.apache.polaris.core.policy.content.maintenance.SnapshotRetentionPolicyContent;
+import org.apache.polaris.core.policy.validator.InvalidPolicyException;
+
+public class SnapshotRetentionPolicyValidator extends 
BaseMaintenancePolicyValidator {
+  public static final SnapshotRetentionPolicyValidator INSTANCE =
+      new SnapshotRetentionPolicyValidator();
+
+  @Override
+  public void validate(String content) throws InvalidPolicyException {
+    SnapshotRetentionPolicyContent.fromString(content);

Review Comment:
   It's not now, but I think it's good to distinguish a validator from a 
parser. We will put more rules in the validator comparing to a parser. For 
example, I'm not sure if negative checking of a max 
age(`max_orphan_file_age_in_days`) should be in the parser or in the validator. 
The json schema can only enforce the type, which is a number, but cannot 
enforce it's range. So theoretically, a pure parser may not check the range, 
but at the same time, we can option-ate on the object within our repo. 
Currently I keep it in the parser, but I'm OK if others think it differently. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to