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

New linting rules for `oneOf`/`anyOf`/`allOf`

Open AlbinaBlazhko17 opened this issue 3 months ago • 2 comments

Is your feature request related to a problem? Please describe.

In the current implementation we didn't handle illogical use of these schema composition keywords (oneOf, anyOf,allOf).

Describe the solution you'd like

Add new linting rule with checks as described below:

Ruleno-illogical-сomposition-keywords should include checks:

  1. Checks for oneOf:
  • If schemas inside oneOf are not mutually exclusive → show warning
  • If any schema inside oneOf is empty -> show warning
  • If oneOf contains only one schema → show warning to use direct schema
  • If oneOf contains duplicated schemas → show warning
  1. Checks for anyOf:
  • If anyOf contains only one schema → show warning to use direct schema
  • If anyOf contains duplicated schemas → show warning
  • If any schema inside anyOf is empty → show warning
  1. Checks for allOf:
  • If any schema inside allOf is empty → show warning
  • If allOf contains duplicated schemas → show warning

Describe alternatives you've considered

Additional context

AlbinaBlazhko17 avatar Sep 26 '25 09:09 AlbinaBlazhko17

@adamaltman, can you please review this issue to see if it matches your request?

AlbinaBlazhko17 avatar Sep 29 '25 09:09 AlbinaBlazhko17

Related: https://github.com/Redocly/redocly-cli/issues/1486. @AlbinaBlazhko17 please have a look.

tatomyr avatar Oct 08 '25 08:10 tatomyr