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
- 200
Successful response
- application/json
- Schema
- Example (from schema)
Schema
- NestedTypeA
- NestedTypeB
- nestedTypeA
- nestedTypeB
oneOf
type stringrequired
Possible values: [nestedTypeA
]
nestedA
object
propA1 string
propA2 number
type stringrequired
Possible values: [nestedTypeB
]
nestedB
object
propB1 string
propB2 boolean
type
string
Possible values: [nestedTypeA
, nestedTypeB
]
type stringrequired
Possible values: [nestedTypeA
]
nestedA
object
propA1 string
propA2 number
type stringrequired
Possible values: [nestedTypeB
]
nestedB
object
propB1 string
propB2 boolean
{
"type": "string"
}
Loading...