-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
Description
I noticed that the following schema is considered valid by the Swagger Editor and other OpenAPI tools:
Dog:
allOf:
- $ref: "#/components/schemas/Pet"
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]However, according to my understanding of OpenAPI specifications:
- The properties keyword should not be valid at the same level as allOf.
allOf takes an array of object definitions that are used for independent validation but together compose a single object.
- The correct way to structure this should be:
Dog: # "Dog" is a value for the pet_type property (the discriminator value)
allOf:
- $ref: "#/components/schemas/Pet"
- type: object
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]Questions for OpenAPI maintainers:
- Is this behavior intentional? Should properties be allowed at the same level as allOf, or is this a parsing mistake in tools like Swagger Editor?
- If this is valid, could you point to the relevant section in the OpenAPI 3.0/3.1 specification that explicitly allows properties at the same level as allOf?
- If it is a mistake, should Swagger Editor and other OpenAPI tools enforce stricter validation to prevent incorrect schema definitions?
I would appreciate any clarification on this matter. Thanks for your help! 🚀