Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
new rules: error for anyOf & oneOf in OpenAPI v2 #393
As an average user who is not completely familiar with the intricacies of JSON Schema <≠> OpenAPI and the differences between OpenAPI v2 and v3, I often mix up JSON Schema, OAS2 and OAS3 keywords like anyOf and oneOf, so please let me know when I put the wrong keyword in the wrong place.
Is your feature request related to a problem?
API description documents should conform to the description format in question, as putting invalid keywords in those documents can lead to inconsistent behavior across various tools that might mistakenly support those keywords. Other tooling which is actually compliant will then look like its failing.
Describe the solution you'd like
The rule should error if an
Is it x-oneOf and x-anyOf or are we putting invalid keywords into their API description documents?
This is all the more reason to create errors for oneOf and anyOf in Spectral. Folks can turn the rule off if they really want to keep on writing invalid documents.