redocly-cli
redocly-cli copied to clipboard
Assertions `pattern` evaluates the key names of the subject's children, not the key names of the subject
Describe the bug
Using assertions, I want to detect PathItems which keys match some pattern. According to the docs, if property key isn't specified, assertions should evaluate against the key names for the subject node type.
However, if I write this:
assert/path-excludes-patterns2:
severity: error
subject: PathItem
pattern: ^\/(?!GET).*
it actually match against the Operation keys (get, post &c.).
To Reproduce Steps to reproduce the behavior:
- Given the
redocly.yamlfile with the assertion above - And this OpenAPI file: https://github.com/Redocly/redocly-cli/blob/master/resources/pets.yaml
- Run
redocly lint pets.yaml - See it doesn't detect the correct
PathItems
Expected behavior
If property key is not provided, assertion should evaluate against the key names for the subject node type.
Redocly Version(s)
1.0.0-beta.106
Node.js Version(s)
16