oapi-codegen
oapi-codegen copied to clipboard
The decriminator is set only if the "mapping" field is present
Related to https://github.com/deepmap/oapi-codegen/pull/471
Hello!
mapping
field is useful for explicit mapping:
In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used
But by default I expected the generated code to set the descriminator field by schema name:
The expectation now is that a property with name petType MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document.
MyResponseType:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
- $ref: '#/components/schemas/Lizard'
discriminator:
propertyName: petType
But now it doesn't work like that. Thanks.
@jamietanna @deepmap-marcinr @Warboss-rus FYI