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

Allow generating an array with all enum model items #303

Closed
luisfpg opened this issue Nov 17, 2023 · 0 comments
Closed

Allow generating an array with all enum model items #303

luisfpg opened this issue Nov 17, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@luisfpg
Copy link
Contributor

luisfpg commented Nov 17, 2023

This is specially useful when using enumStyle is alias.
In this case it is not possible to iterate over all enum items, as they only exist at compilation time.
However, in some particular cases this is useful.
So, the idea is to add a new boolean option enumArray (default false) to generate a ts file next to the enum file, suffixed with -array.ts, which exports a const with all enum items in an array.
This file isn't even included in the model index (models.ts).
This way the overhead on generated code is minimal, and will only include arrays of actually used enums.

@luisfpg luisfpg added the enhancement New feature or request label Nov 17, 2023
FlorianGrimm pushed a commit to FlorianGrimm/ng-openapi-gen that referenced this issue Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant