openapi-typescript version
7.13.0
Node.js version
v24.13.0
OS + version
Debian GNU/Linux 13 (trixie)
Description
If the schema declares a oneOf property with discriminator the generated Types will have their name as discriminator value and their value at same time. So generated type is always never.
Reproduction
Schema: https://yookassa.ru/developers/api/yookassa-openapi-specification.yaml
Generated type is never
ConfirmationDataExternal: Omit<components["schemas"]["ConfirmationData"], "type"> & Record<string, never> & {
/**
* @description discriminator enum property added by openapi-typescript
* @enum {string}
*/
type: "ConfirmationDataExternal";
} & {
/**
* @description discriminator enum property added by openapi-typescript
* @enum {string}
*/
type: "external";
};
Expected result
ConfirmationDataExternal: Omit<components["schemas"]["ConfirmationData"], "type"> & Record<string, never> & {
/**
* @description discriminator enum property added by openapi-typescript
* @enum {string}
*/
type: "external";
};
Schema has issues, but not here.
ConfirmationData:
description: "Information required to initiate the selected payment confirmation scenario by the user. More about confirmation scenarios: https://yookassa.ru/developers/payment-acceptance/getting-started/payment-process#user-confirmation"
type: "object"
properties:
type:
$ref: "#/components/schemas/ConfirmationDataType"
locale:
$ref: "#/components/schemas/Locale"
discriminator:
propertyName: "type"
mapping:
redirect: "#/components/schemas/ConfirmationDataRedirect"
external: "#/components/schemas/ConfirmationDataExternal"
qr: "#/components/schemas/ConfirmationDataQr"
embedded: "#/components/schemas/ConfirmationDataEmbedded"
mobile_application: "#/components/schemas/ConfirmationDataMobileApplication"
required:
- "type"
....
ConfirmationDataType:
description: "Type of payment confirmation scenario by the user. Possible values: redirect - redirecting the user to a ready-made YooMoney page or a partner's page; external - waiting for the user to confirm the payment independently; qr - generating a QR and displaying it on the payment page so that the user can confirm the payment; embedded - displaying the YooMoney payment widget; mobile_application - redirecting the user to the partner's payment app."
type: "string"
enum:
- "redirect"
- "external"
- "qr"
- "embedded"
- "mobile_application"
....
ConfirmationDataExternal:
type: "object"
allOf:
- $ref: "#/components/schemas/ConfirmationData"
- type: "object"
Required
Extra
openapi-typescript version
7.13.0
Node.js version
v24.13.0
OS + version
Debian GNU/Linux 13 (trixie)
Description
If the schema declares a oneOf property with discriminator the generated Types will have their name as discriminator value and their value at same time. So generated type is always
never.Reproduction
Schema:
https://yookassa.ru/developers/api/yookassa-openapi-specification.yamlGenerated type is
neverExpected result
Schema has issues, but not here.
Required
npx @redocly/cli@latest lint)Extra