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

FR: New rule: no-$ref-siblings

Open wedi opened this issue 3 years ago • 1 comments

From my experience it's a very common mistake to add siblings to $refs, especially when someone wants to change the description, title or example of a referenced element.

A rule that detects this might be helpful for many.

Mistake in OpenAPI 3.0, allowed in OpenAPI 3.1:

- $ref: '#/components/parameters/search'
  example: '-birthday,firstName'
  ...

Correct alternative in OpenAPI 3.0:

- allOf:
    - $ref: '#/components/parameters/search'
  example: '-birthday,firstName'
  ...

wedi avatar Apr 17 '22 12:04 wedi

I thought we had no-sibling-refs rule, but I cannot find it.

adamaltman avatar Apr 17 '22 14:04 adamaltman