swagger-api / swagger-api/swagger-client
Schema reference names clash
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 765
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 6
Description
From @Gingol on June 13, 2018 8:58
Hi all,
I'm not sure if it is the right place where report this kind of problem, so please, redirect me to the right project in case I mistake.
During the creation of my specification I obtained a list of errors like this:
Resolver error
Cannot read property '0' of undefined
Analyzing the situation I figured out that it was due to the references between the schemas.
This is a simple example of schemas that generate the errors.
schemas:
B:
type: object
properties:
field:
type: string
C:
allOf:
- $ref: '#/components/schemas/B'
D:
allOf:
- $ref: '#/components/schemas/B'
type: object
properties:
field:
allOf:
- $ref: '#/components/schemas/C'
Searching online I found some issues regarding circular references and similar, but it seems that all was resolved with a certain version of the editor and I think that mine is a different problem.
I think that the desired output for the schema D would be something like this:
{
field: {
field: "string"
}
}
Thank you
--
Mauro
Copied from original issue: swagger-api/swagger-editor#1793
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
Start by reproducing the resolver error with the minimal B, C, and D schemas shown in the issue. Trace schema reference resolution for D and its nested field; done means the example resolves without the undefined-property error and produces the expected nested structure.
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
- 30/100