x-extendedDiscriminator
This specification extension is supported only in OpenAPI 2.0. The functionality it provides is superseded by mapping
in OpenAPI 3.
It is a Redocly-specific extension unsupported by other tools.
Usage
Use x-extendedDiscriminator
in your OpenAPI 2.0 documents to solve name-clash issues with the standard discriminator
property. Add it to the schema
OpenAPI object.
The value of this field specifies which field is used as an extended discriminator. In the documentation, Redocly displays a picker menu where users can select the value of the x-extendedDiscriminator
-marked field.
Redocly displays the definition which is derived from the current (using allOf
) and which has enum
with only one value. That value must be the same as the selected value of the field specified as x-extendedDiscriminator
.
Field Name | Type | Description |
---|---|---|
x-extendedDiscriminator | string | Specifies the extended discriminator. |
Examples
Payment:
x-extendedDiscriminator: type
type: object
required:
- type
properties:
type:
type: string
name:
type: string
CashPayment:
allOf:
- $ref: '#/definitions/Payment'
- properties:
type:
type: string
enum:
- cash
currency:
type: string
PayPalPayment:
allOf:
- $ref: '#/definitions/Payment'
- properties:
type:
type: string
enum:
- paypal
userEmail:
type: string
In this example, the names of definitions (PayPalPayment
) are different than names in the payload (paypal
), which is not supported by the default discriminator
property.