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
public enum PetType {
@JsonEnumDefaultValue
cat,
dog
}
public class Pet {
private PetType type;
}
deserializing of {type: "fish"} results in type == PetType.cat
but deserializing of {type: ""} results in coercion failure:
com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot coerce empty String ("") to PetType value (but could if coercion was enabled using CoercionConfig)
Looks like CoercionConfigs takes precedence before READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE. Enabling ACCEPT_EMPTY_STRING_AS_NULL_OBJECT makes all "" enums nulls.
Expected behavior: empty strings are mapped to default enum value if READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE is enabled and ACCEPT_EMPTY_STRING_AS_NULL_OBJECT is not enabled.
The text was updated successfully, but these errors were encountered:
version: 2.12.13
deserializing of
{type: "fish"}
results in type ==PetType.cat
but deserializing of
{type: ""}
results in coercion failure:Looks like CoercionConfigs takes precedence before READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE. Enabling ACCEPT_EMPTY_STRING_AS_NULL_OBJECT makes all "" enums nulls.
Expected behavior: empty strings are mapped to default enum value if READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE is enabled and ACCEPT_EMPTY_STRING_AS_NULL_OBJECT is not enabled.
The text was updated successfully, but these errors were encountered: