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
I searched in the issues and found nothing similar.
Describe the bug
I enable the READ_UNKNOWN_ENUM_VALUES_AS_NULL feature on ObjectMapper and disable it using @JsonFormat(without = JsonFormat.Feature.READ_UNKNOWN_ENUM_VALUES_AS_NULL) annotation.
I think the priority of annotation should be higher than global config. But the READ_UNKNOWN_ENUM_VALUES_AS_NULL is still enabled.
Version Information
2.17.0
Reproduction
<-- Any of the following
Brief code sample/snippet: include here in preformatted/code section
Longer example stored somewhere else (diff repo, snippet), add a link
Exception in thread "main" com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type`org.example.JacksonDemo$Color` from String "WHITE": not one of the values accepted for Enum class: [RED, BLUE]
Reported problem seems legit, per-field override should have precedence over global setting. I am not sure about fix, I think it should not use Boolean.TRUE.equals(_useNullForUnknownEnum) but simply _useNullForUnknownEnum (since results Boolean.equals() is never null).
cowtowncoder
changed the title
Unable to disable READ_UNKNOWN_ENUM_VALUES_AS_NULL feature
Unable to override DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL with JsonFormat.Feature.READ_UNKNOWN_ENUM_VALUES_AS_NULLApr 19, 2024
Search before asking
Describe the bug
I enable the
READ_UNKNOWN_ENUM_VALUES_AS_NULL
feature on ObjectMapper and disable it using@JsonFormat(without = JsonFormat.Feature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)
annotation.I think the priority of annotation should be higher than global config. But the
READ_UNKNOWN_ENUM_VALUES_AS_NULL
is still enabled.Version Information
2.17.0
Reproduction
<-- Any of the following
-->
Expected behavior
Additional context
Current implementation
https://github.com/FasterXML/jackson-databind/blob/2.17/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java#L488-L491
Expected
The text was updated successfully, but these errors were encountered: