Skip to content

api-morph / DiscriminatorObject

Interface: DiscriminatorObject

Defined in: src/types/openapi.ts:1076

When request bodies or response payloads may be one of a number of different schemas, a Discriminator Object gives a hint about the expected schema of the document. This hint can be used to aid in serialization, deserialization, and validation. The Discriminator Object does this by implicitly or explicitly associating the possible values of a named property with alternative schemas.

See

https://spec.openapis.org/oas/v3.1.1#discriminator-object

Indexable

[key: `x-${string}`]: any

This object MAY be extended with Specification Extensions.

Properties

mapping?

optional mapping: Record<string, string>

Defined in: src/types/openapi.ts:1086

An object to hold mappings between payload values and schema names or URI references.


propertyName

propertyName: string

Defined in: src/types/openapi.ts:1081

REQUIRED. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined.

基于 MIT 许可证发布