GoogleCloudPlatform / config-validator

Golang library which provides functionality to evaluate GCP resources against Rego-based policies
Apache License 2.0
45 stars 34 forks source link

Upgraded to constraint framework v0.2.1 #185

Closed melinath closed 2 years ago

melinath commented 2 years ago

@maxsmythe I'm getting errors like this after the upgrade:

spec.validation.openAPIV3Schema.properties[spec].properties[match].type: Required value: must not be empty for specified object fields

Comparison between old & new code: https://github.com/open-policy-agent/frameworks/compare/804ff2ee8b4f...v0.2.1

Here's the template triggering the errors: https://github.com/GoogleCloudPlatform/config-validator/blob/master/test/cf/templates/gcp_storage_logging_template.yaml

Do you happen to know how I can resolve this? I've looked into it but tbh I don't even understand the error message - spec.validation.openAPIV3Schema.properties exists but it doesn't have a spec property (let alone one that's not dot-accessed?) - my best guess is that it might be related to constraint/deploy/crds.yaml somehow

melinath commented 2 years ago

The issue turned out to be that MatchSchema's return value is subject to stricter validation than the rest of the CRD.