swagger-js
swagger-js copied to clipboard
OpenAPI 3.1.0: error when resolving schemas with allOf and circular references
NOTE: this will also be affecting ApiDOM OpenAPI 3.0.x dereferencing. Another issues needs to be create for ApiDOM repo.
Content & configuration
Swagger/OpenAPI definition:
openapi: 3.1.0
components:
schemas:
First:
allOf:
- $ref: '#/components/schemas/Second'
Second:
allOf:
- $ref: '#/components/schemas/Third'
Third:
allOf:
- $ref: '#/components/schemas/Second'
Describe the bug you're encountering
Resolving a subtree or the entire definition will cause an error TypeError: Elements in allOf must be objects.
To reproduce...
Steps to reproduce the behavior:
- Go to https://editor-next.swagger.io/
- Paste the definition
- Open any of the schemas
- See the error
Screenshots
The result of opening Second and then Third schema: