redocly-cli
redocly-cli copied to clipboard
New linting rules for `oneOf`/`anyOf`/`allOf`
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:
- 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
- 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
- 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
@adamaltman, can you please review this issue to see if it matches your request?
Related: https://github.com/Redocly/redocly-cli/issues/1486. @AlbinaBlazhko17 please have a look.