CodeSquared docs

OasUnion

OasUnion is an object representing a union type as expressed in OpenAPI as oneOf or anyOf.

Properties

PropertyTypeDescription
oasType'schema'Static value representing the OpenAPI union type.
type'union'Static value indicating union type.
titlestring | undefinedOptional title of the union type.
descriptionstring | undefinedOptional description of the union type.
nullableboolean | undefinedOptional flag indicating if the union type is nullable.
exampleunknown | undefinedOptional example value for the union type.
discriminatorOasDiscriminator | undefinedOptional Discriminator object used to tag member types and make the union a tagged union.
membersOasSchema | OasRef<'schema'>Union members types.
extensionFieldsRecord<string, unknown> | undefinedOptional map of custom fields defined by OpenAPI extensions. Keys are strings beginning with x- and values are of any valid JSON type.

Methods

isRef

Returns false indicating that the union is not a reference.

union.isRef()

Return value

false

resolve

Returns the union object itself.

union.resolve()

Return value

The union object itself.

resolveOnce

Returns the union object itself.

union.resolveOnce()

Return value

The union object itself.