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

ts-swagger: option to preserve enum names (as closely as possible) #937

Closed
florence-wolfe opened this issue Apr 15, 2024 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@florence-wolfe
Copy link

florence-wolfe commented Apr 15, 2024

What is the problem this feature would solve?

There are many enum name generation options in the current ts-swagger generator. They work wonders, however, there are many cases in which users may want to retain the original enum name as closely as possible. Of course, in the OAS there can be invalid characters, but many enums follow predictable casing such as UPPER_SNAKE or even lower_snake, among others. The idea would be to strip out invalid characters and preserve the rest of the name. This should be similar to the existing options.

This would allow users to continue to use their originally formatted enum names, even if it's in a cursed casing like SpOnGeBoBcAsE and then use either as const or enum or const enum.

For example

const MY_ENUM = {
  key: 'value',
} as const

enum MY_ENUM {
 key = value,
 }
 
 const enum MY_ENUM {
   key = value,
 }

External documents/projects?

No response

What is the feature you are proposing to solve the problem?

No response

What alternatives have you considered?

No response

@florence-wolfe florence-wolfe added the enhancement New feature or request label Apr 15, 2024
@stijnvanhulle stijnvanhulle closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2024
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

2 participants