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

OpenAPI 3.x Go generation's weirdness for enum names #292

Open
longquanzheng opened this issue Jul 4, 2023 · 0 comments
Open

OpenAPI 3.x Go generation's weirdness for enum names #292

longquanzheng opened this issue Jul 4, 2023 · 0 comments

Comments

@longquanzheng
Copy link
Contributor

longquanzheng commented Jul 4, 2023

Currently, the enum names will be stripped the common prefixes.
If

        - FORCE_COMPLETE_ON_INTERNAL_CHANNEL_EMPTY
        - FORCE_COMPLETE_ON_SIGNAL_CHANNEL_EMPTY

Then the enum names are:

INTERNAL_CHANNEL_EMPTY
SIGNAL_CHANNEL_EMPTY

However, if

        - FORCE_COMPLETE_ON_INTERNAL_CHANNEL_EMPTY
        - FORCE_COMPLETE_ON_SIGNAL_CHANNEL_EMPTY
        - GRACEFUL_COMPLETE_ON_ALL_CHANNELS_EMPTY

Then the enum names are

FORCE_COMPLETE_ON_INTERNAL_CHANNEL_EMPTY
FORCE_COMPLETE_ON_SIGNAL_CHANNEL_EMPTY
GRACEFUL_COMPLETE_ON_ALL_CHANNELS_EMPTY

Because they don't have the shared common prefix anymore. The generator is "trying to be smart" but it's a terrible idea to do this without any parameter to control.
This would be a problem because the enum names are unstable as adding different values.
It will be nice to somehow get rid of this "smart stripping"...

A workaround today is to use "enumClassPrefix=true" however, this is also a breaking change to all enum names, and also the enum names will be quite ugly...

Reported in OpenAPITools/openapi-generator#16002

As a workaround today, make sure to have at least a letter different in all the enums from beginning...

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

No branches or pull requests

1 participant