iting0321 commented on code in PR #3896:
URL: https://github.com/apache/polaris/pull/3896#discussion_r2930862272
##########
polaris-core/src/main/java/org/apache/polaris/core/policy/validator/PolicyValidators.java:
##########
@@ -50,10 +51,20 @@ public class PolicyValidators {
public static void validate(PolicyEntity policy) {
Preconditions.checkNotNull(policy, "Policy must not be null");
- var type = PredefinedPolicyTypes.fromCode(policy.getPolicyTypeCode());
- Preconditions.checkArgument(type != null, "Unknown policy type: " +
policy.getPolicyTypeCode());
+ // First check if this is a known policy type (predefined or registered
custom type)
+ var policyType = PolicyType.fromCode(policy.getPolicyTypeCode());
+ Preconditions.checkArgument(
+ policyType != null, "Unknown policy type: " +
policy.getPolicyTypeCode());
+
+ // Only validate content for predefined policy types
+ var predefinedType =
PredefinedPolicyTypes.fromCode(policy.getPolicyTypeCode());
+ if (predefinedType == null) {
+ // Custom/test policy type - skip content validation
+ LOGGER.info("Skipping content validation for custom policy type: {}",
policyType.getName());
+ return;
+ }
Review Comment:
IMHO, we still need to ensure that the the PolicyType is `known` (either
predefined or registered in the PolicyTypeRegistry) before proceeding.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]