Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downgrade additionalProperties violations to warnings #1157

Open
lcarva opened this issue Sep 26, 2024 · 0 comments
Open

Downgrade additionalProperties violations to warnings #1157

lcarva opened this issue Sep 26, 2024 · 0 comments

Comments

@lcarva
Copy link
Member

lcarva commented Sep 26, 2024

When validating rule data, we often set additionalProperties to false, see example. The value of doing this is that it allows us to catch typos on non-required properties.

However, when we want to add a new property, we must carefully synchronize changes. After all, older versions of ec-policies will emit a violation for such property.

Let's introduce a mechanism to bring the best of both sides. Instead of emitting a violation when an unknown property is used, let's emit a warning.

Because this pattern will have to me used in multiple places within this repo, it's a good idea to create some sort of helper rule for this.

To avoid duplicating policy rules (one for schema violations and one for schema warnings), let's leverage enterprise-contract/ec-cli#2025 for this work.

Acceptance Criteria

  • When unknown properties are used for rule data items, a warning is emitted instead of a violation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant