Schema reference names clash
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
From @hkosova on June 19, 2018 23:45
Your example produces the desired output in the latest version of the Swagger Editor at https://editor.swagger.io and does not trigger any errors. But this example does not make sense because schema D is equivalent to
D:
type: object
allOf:
- properties:
field:
type: string
- properties:
field:
type: object
properties:
field:
type: string
or the simplified version
D:
type: object
properties:
field:
allOf:
- type: string
- type: object
properties:
field:
type: string
and the top-level field property cannot be type: string and type: object at the same time.
From @Gingol on June 20, 2018 6:55
Hi @hkosova,
thank you for your reply. I tried again to copy my example in the swagger editor you linked and I still get the errors. I attached an image:

I know that it might not be the standard way to define schemas and that it might not be a common case, but I think that what should happen is just an override of the element like in both the example you posted.
Regards