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

Function aware schema validation rules #3672

Open
2 tasks done
kddejong opened this issue Sep 7, 2024 · 0 comments
Open
2 tasks done

Function aware schema validation rules #3672

kddejong opened this issue Sep 7, 2024 · 0 comments

Comments

@kddejong
Copy link
Contributor

kddejong commented Sep 7, 2024

Is this feature request related to a new rule or cfn-lint capabilities?

New capability

Describe the feature you'd like to request

Currently when doing custom rules with JSON schema based validation we do strict type checking which means we don't handle conditions well or will skip those custom rules when run into functions like Fn::If. To increase coverage of these tests it would be awesome if we could build checks that are condition aware.

Describe the solution you'd like

This typically comes up when we are looking for property changes as a result of a value of another property.

{
  "if": {
    "properties": {
      "Foo": {
        "enum": ["A"]
       }
    },
    "required": ["Foo"]
  },
  "then": {
     "required": ["Bar"]
  }
}

If Foo and Bar have Fn::If values we currently skip validation. What we need to be able to do is validate the true/false path of each properties value combined together. While this schema is simple it gets more complicated if we are evaluating many properties or keywords in the "if"

Additional context

Whatever mechanism we come up with should be able to converted to JSON schema draft 7 so we can continue to create valid schemas that can be used other processes. In these scenarios the functions would be resolved allowing us to do a more direct validation.

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
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