Skip to main content

Discriminator with Nested Schemas and Mapping

GET 

/discriminator-nested-mapping

Schema:

type: object
discriminator:
propertyName: type
mapping:
nestedTypeA: "#/components/schemas/NestedTypeA"
nestedTypeB: "#/components/schemas/NestedTypeB"
properties:
type:
type: string
oneOf:
- $ref: '#/components/schemas/NestedTypeA'
- $ref: '#/components/schemas/NestedTypeB'

Responses

Successful response

Schema

    oneOf

    type stringrequired

    Possible values: [nestedTypeA]

    nestedA

    object

    propA1 string
    propA2 number

    type

    string

    Possible values: [nestedTypeA, nestedTypeB]

    type stringrequired

    Possible values: [nestedTypeA]

    nestedA

    object

    propA1 string
    propA2 number
Loading...