swagger-api / swagger-api/swagger-client
OpenAPI 3.1.0: error when resolving schemas with allOf and circular references
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 765
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 6
Description
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:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the circular allOf example in editor-next.swagger.io by opening the Second and Third schemas. Trace the schema resolution or dereferencing entry point that produces “Elements in allOf must be objects”; done means resolving the subtree or full definition without that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100