-
Notifications
You must be signed in to change notification settings - Fork 407
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
Added recommandation against enums #133
Conversation
Maybe adapt the compatibility section which mentions this, too. |
Added links and improved wording. |
During the meeting we discussed whether the name I originally proposed this name for the extension property in the guidelines, and took the syntax from Swagger's Some arguments for/against changing:
@ALL What would be better names? Just If we are already changing the name of the property, we could consider to add a description for each item. The next version of OpenAPI likely will have be some way of documenting each enum item, maybe we want to do this similarly? (Though that is not yet finished.) |
|
+1 on using an object for this to add descriptions per value. |
@whiskeysierra hmm, can you give an example, what you have in mind? |
@tkrop Event:
description:
An event which will be delivered to Nakadi (or other event sinks),
together with some metadata used by Tarbela.
type: object
properties:
[...]
delivery_status:
type: string
description: |
The delivery status of an event.
x-samples:
- value: NEW
description:
the event was created in the producer, and not yet tried to publish.
- value: SENT
description: the event was successfully published to the event sink.
- value: ERROR
description: something did go wrong with publishing the event. For enum-like string properties something like this would also work: properties:
delivery_status:
type: string
description: the code of the discount type for this discount condition.
x-samples:
NEW: the event was created in the producer, and not yet tried to publish.
SENT: the event was successfully published to the event sink.
ERROR: something did go wrong with publishing the event. (This could go into Tarbela's producer API). |
@ePaul @whiskeysierra great suggestion. Which one should I pick for example? both? |
The first one is more powerful, I'd say. But I don't like to have Java-idomatic enum values (upper underscore). I think snake case or lower hyphen would be a better fit. |
@whiskeysierra I think it is not only Java, but many other programming languages too ... event if http://blog.josephwilk.net/rhetorical-programming/why-are-you-shouting-programmer.html isn't a good reference ;) @ALL I'm willing to change it to lower snake case if some more reviewers support this request. |
The example was from an existing API, which used upper-case values. For an example in the Guidelines of how this should look of course you can write them differently. (I guess we still need some explanation text around this.) |
👍 |
1 similar comment
👍 |
Fixes #119