-
Notifications
You must be signed in to change notification settings - Fork 190
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
Handle const like enum with --const-as-enum option #2073
Conversation
8f128cb
to
35de56c
Compare
cant we settle on a default behavior that works for everyone? I dont like the approach of adding a new option just for this. Seems like trivial information that is hard to teach via documentation that if used incorrectly will lead to unexpected behavior. |
Yes, let's not add a config option. |
So, you prefer to make it as a default behavior (instead of "const" always use "enum" with single value), could it be a breaking change for current users? Probably, somebody needs to have a "const" in their schema... |
cc5d89c
to
8ba7b5d
Compare
whats the preferred way according to openapi spec? |
"const" keyword supported by the openapi 3.1.0 (the actual version) Accoding to the specification, it is an equivalent to an enum with a single value: |
Then why we are doing this PR in the first place? I think we should use what was specified first to increase compatibility. Everything else either by a flag or just don't implement it at all. |
Ups, I think I misunderstood the original issue. Yeah, let's keep the default behavior and if anyone needs enums, they can use the custom formatter from #1899 (comment) by @vladimir-prisada. Sorry for misleading here, everyone. |
Closes #1899