Open leon0399 opened 2 months ago
A temporary solution that even might be better in some way:
Instead of relying on discriminators based on property, I assigned this property a schema of enum with one entry:
components:
responses:
sampleObjectResponse:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/simpleObject'
- $ref: '#/components/schemas/complexObject'
- discriminator:
- propertyName: objectType
…
schemas:
simpleObject:
type: object
required:
- objectType
properties:
objectType:
type: string
+ enum:
+ - simpleObject
…
complexObject:
type: object
required:
- objectType
properties:
objectType:
type: string
+ enum:
+ - complexObject
…
Package version 0.22.0
Describe the bug Schema discriminator is not supported: https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
To Reproduce
Expected behaviour The validator must find a schema based on the discriminator
Additional context I've tried to make a fix myself, but does not know how to resolve the schema by ref from the validator:
src/Schema/Keywords/OneOf.php:59