openapi-ts / openapi-typescript

Generate TypeScript types from OpenAPI 3 specs
https://openapi-ts.dev
MIT License
5.86k stars 468 forks source link

Please add support for x-enumNames and x-enumDescriptions in upcoming v 7 #1412

Closed alex-aveva closed 1 week ago

alex-aveva commented 1 year ago

Description

The most popular (and de-facto standard) .NET Core OpenAPI NSwag package uses the following:

Proposal

Adapting the code can be as simple as shown below:

https://github.com/drwpow/openapi-typescript/blob/43b1b69bc26ee333d0fed1f4aa702496c485dc01/packages/openapi-typescript/src/transform/schema-object.ts#L128

        name: schemaObject["x-enum-varnames"]?.[i] ?? schemaObject["x-enumNames"]?.[i],
        description: schemaObject["x-enum-descriptions"]?.[i] ?? schemaObject["x-enumDescriptions"]?.[i],

Checklist

drwpow commented 1 year ago

I’d be open to this! This is an easy add.

Also if you do submit a PR, then make sure to update the corresponding docs that mention x-enum-varnames as well.

alex-aveva commented 1 year ago

That's great, I'll create a PR!

duncanbeevers commented 3 months ago

I think this issue can be closed. Support for these was originally added in c947515.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] commented 1 week ago

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.