-
Notifications
You must be signed in to change notification settings - Fork 47
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
Make extensible enums actually extensible #213
Comments
Interesting idea. The way we use this feature is we opt-in to the alias when generating the server-side but leave it disabled for client side. That way we get the strict typing server side, and our clients don't break when we extend with new values. Your proposal might be a nice improvement though. Side note, I've a relatively clear calendar tomorrow and will try and catch up fabrikt issues and PRs |
So you're mainly using it for extensibility in responses (i.e. the client might have to deal with unknown values) and my proposed change would offer extensibility in requests (i.e. the server might have to deal with unknown values). Correct?
Nice, thank you :) |
Yes, at Zalando x-extensible-enum is used to communicate to clients that: these are the current options, but new options may be added in the future To my knowledge, it is never used to allow clients to make requests using undefined enum values, only to prepare clients to gracefully handle responses with unexpected new enum values as the API evolves over time. |
Right now, using
x-extensible-enum
to declare an enum instead of theenum
keyword does not actually generate "extensible enums", as the name suggests. Instead, it's just an alias for "enum". For example, this enum model here:should actually look more like this when marked as "extensible": (untested code)
The text was updated successfully, but these errors were encountered: