-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Merge enums #495
base: vNext
Are you sure you want to change the base?
Merge enums #495
Conversation
|
||
## Problem | ||
|
||
The API Design requires that a specific property of a data structure has a finite and limited set of values, and such limitation needs to be clearly communicated to the user and give the developer the same structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please ground the problem in a real design scenario. A good example is at https://github.com/microsoft/api-guidelines/blob/vNext/graph/patterns/alternate-key.md#problem or https://github.com/microsoft/api-guidelines/blob/vNext/graph/patterns/evolvable-enums.md#problem.
|
||
## Solution | ||
|
||
In OData, Enums represent a subset of the nominal type they rely on, and are especially useful in cases where certain properties have predefined, limited options. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum solution must be based on the evolvable enum. Not evolvable enums are exceptions. Could you please merge all template sections together? it doesn't make sense to have the same section in one document twice.
|
||
- Our SDK generators will translate the enum to the best representation of the target programming language, resulting in a better developer experience and free client side validation | ||
|
||
#### Cons | ||
### Cons | ||
|
||
- Adding a new value requires to go through a (generally fast) API Review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our internal process shouldn't impact API design considerations especially as they published for external users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is a clear side effect which is annoying for a lot of workload owners. I can remove it if you want, but we're missing a particular part that affect us. Your call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this. We might offer some process guidance in the future, but I don't think it's our area of expertise now or something we are working on.
|
||
## Issues and considerations | ||
|
||
### Pros | ||
|
||
- Our SDK generators will translate the enum to the best representation of the target programming language, resulting in a better developer experience and free client side validation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the pros for Enums is that clients can write a processing logic based on the enum values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that true for any property? Clients write processing logic based on values - not too sure what is different here
Closes #494