-
Notifications
You must be signed in to change notification settings - Fork 62
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
[FEATURE] Represent enums which have aliases #593
Comments
We could potentially re-use the GeoOrientation:
oneOf:
- title: left
type: string
enum:
- left
- LEFT
- clockwise
- cw
- title: right
type: string
enum:
- right
- RIGHT
- counterclockwise
- ccw |
I like the proposal. Is there a downside to treating these as separate values? Where do we need the semantic meaning of equivalence? |
Main downside from the Java client's side is that breaking them out into separate values would be a breaking change for users (i.e. if previously had Splitting them out also may lead to confusion for users as they suddenly have new distinct options that are not actually distinct options. i.e. you put index with |
We can also keep it as one big enum type with all the values and has a way to communicate with the user that certain values are equal (via the (Both approaches will yield the same result in the TS generator, so this is only affecting Java.) |
While not yet generated, it is also currently represented in .NET: https://github.com/opensearch-project/opensearch-net/blob/main/src/OpenSearch.Client/Mapping/Types/Geo/GeoShape/GeoOrientation.cs |
Is your feature request related to a problem?
There are enums that OpenSearch accepts where multiple string representations map to the same value, with one being the canonical representation (i.e. they're aliased).
Example:
Current spec of
GeoOrientation
:Implementation of
Orientation
in OpenSearch:Existing implementation of
GeoOrientation
in opensearch-java (on serialization first item is used, all accepted for deserialization):Note that we also handle all-caps variants as if OpenSearch itself sets and returns its version it will be uppercase.
This means the final spec should be roughly equivalent to:
But should also communicate that
left
andright
are the canonical versions and others map onto them.The text was updated successfully, but these errors were encountered: