Closed josh-burton closed 2 years ago
Didn't get the mention cause of formatting.
We should check if other generators have a fallback behavior.
Maybe just use default
?
@wing328 Is there something like fallback values somewhere?
Ran into an unannounced API update today that introduced new enum values :)
Couple links for future reference: https://github.com/OAI/OpenAPI-Specification/issues/1552 https://opensource.zalando.com/restful-api-guidelines/#112
@josh-burton What do you think about adding something like an x-enum-fallback
?
@kuhnroyal yeah that would be great. Letting the user choose which value is the fallback would be the ideal solution.
@josh-burton This is fixed now :)
hi @kuhnroyal
Could you clarify how this should work?|
I do not see any usage in @JsonKey
for unknownEnumValue
parameter
BuiltValue supports setting an enum entry as a fallback to use if the serialized enum value doesn't exist.
This is great for backwards compatibility in APIs as an enum can fallback to an 'unknown' value.
@BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{^isInteger}}wireName: r{{{value}}}{{/isInteger}}{{#-first}}, fallback: true{{/-first}})