-
Notifications
You must be signed in to change notification settings - Fork 742
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
Guidance on x-ms-enum for extensibility #2950
Comments
Whether an individual code-generator creates extensible enums is really dependent on the language and the intent that the generator is after. OpenAPI isn't so much about "Code generation" as it is documenting a remote interface. Since it uses JSON Schema to describe things, it inherits it's strangeness--including using the word "enum" to represent possible values. Generators will of course, look at
In Azure, when we mark an enum with The trouble with making a "standard" is that the hints to the code generator don't really belong in the OpenAPI document. Describing the API accurately does. What it feels like you're really asking for is a standardized way of describing a property as "Here are the known values today, AND there might be others." ... which a code generator could use to make a good decision on how to represent the API in code. In this case, OAI's desire to use JSON Schema is limiting, since JSON Schema doesn't have a way of describing that. Not sure where that takes you ❓ |
Thanks @fearthecowboy ! Yes, what I'm really after is this:
The challenge we have is that our product feature set is growing and growing a mile a minute, not unlike other companies I'm sure, and as we both add functionality as well as respond to customer requests for features/enhancements/fixes, its possible that the amount of enums/choices for a given REST api could expand (obviously changing the original values would be breaking). A crude example would be something like "GET ServiceStatus", where the available services today are an enhancement request comes along to add "puppy" service, so now the choices are Ideally, I'd just like to tack on puppy to the list and be done with it. |
|
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
Hey Azure team!
As part of some API design activities at our company, we've been looking into ways to have extensible enums, instead of the traditional
enum
that openapi provides.As such, earlier this year, I posted a feature request to openapi upstream, here: OAI/OpenAPI-Specification#1552
Specifically around upstream adopting some sort of extensible enum support. I came across x-ms-enum, and (gut feeling) it feels right. IMHO, I really like the what that Azure has approached this problem, as not only do you work around the static enum issues that have plagued coding styles forever, but you get the opportunity to add even more extensibility than just a simple growable list.
that said, OpenAPI has come back with the comment, here: OAI/OpenAPI-Specification#1552 (comment)
If I'm reading this documentation right, is Azure saying that
x-ms-enum
is not extensible, such that any additions tox-ms-enum
would be a breaking change? Or are we saying that you CAN extendx-ms-enum
and NOT have a breaking change?I'm curious to get your teams sage guidance on this, and see if there is a way to potentially parlay all of these efforts together to come up with a single community standard, that then we could perhaps help the openapi upstream community adopt.
Lemme know!
jon@nutanix.com, github.com/nutanix
The text was updated successfully, but these errors were encountered: