redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Assertions `pattern` evaluates the key names of the subject's children, not the key names of the subject

Open tatomyr opened this issue 3 years ago • 0 comments

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:

  1. Given the redocly.yaml file with the assertion above
  2. And this OpenAPI file: https://github.com/Redocly/redocly-cli/blob/master/resources/pets.yaml
  3. Run redocly lint pets.yaml
  4. 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

tatomyr avatar Aug 12 '22 13:08 tatomyr