Skip to main content

Nested Discriminator in allOf

POST 

/discriminator-nested-allof

Tests discriminators nested within allOf structures, where the discriminator and its property definition are inside an allOf item rather than at the top level. This is a common pattern when combining shared properties with discriminated unions.

Schema:

allOf:
- $ref: '#/components/schemas/CommonProps'
- oneOf:
- $ref: '#/components/schemas/NestedVariantA'
- $ref: '#/components/schemas/NestedVariantB'
discriminator:
propertyName: variantType
mapping:
variant-a: '#/components/schemas/NestedVariantA'
variant-b: '#/components/schemas/NestedVariantB'

Request

Responses

Successful response