Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Extend useEnums to all schema files #223

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sschw
Copy link

@sschw sschw commented Feb 26, 2024

Problem

The useEnum flag currently only generates the enums for the types defined in the schemas section of the OpenApi file.

If you define an enum directly in the parameter section, string literals are still used to define the type.

Solution

Using the same logic from the schema enum generator, the enums can also be generated for responses, requestBodies and parameters.

Limitation

This only covers the enums generated for the types generated by generateSchemaTypes. The components file will still generate string literals for parameters. This can be seen for the tests with colorParam in generatingReactQueryComponents.test.ts.

@sschw sschw force-pushed the feat-enum-schema branch from 0bf61dd to 9a4d362 Compare May 2, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant