You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to set an enum value as the default in case it is not able to unmarshall to the target object?
i.e. The server has a new enum value returned but client does not have the updated API yet, so let the client marshal the new enum value to an UNKNOWN default value instead of null.
Something like having the the default enum value annotated with @JsonEnumDefaultValue so it will work with the object mapper DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE configuration.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there a way to set an enum value as the default in case it is not able to unmarshall to the target object?
i.e. The server has a new enum value returned but client does not have the updated API yet, so let the client marshal the new enum value to an UNKNOWN default value instead of null.
Something like having the the default enum value annotated with
@JsonEnumDefaultValue
so it will work with the object mapperDeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
configuration.Beta Was this translation helpful? Give feedback.
All reactions