-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Coercion shouldn't be necessary for Enums specifying an empty string #4896
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
Comments
@joaocanaverde-blue I agree, this sounds like a bug; edge case handled incorrectly. |
Hmmmh. Interesting... the problem here is actually handling of
due to
Will need to think of how to tackle this. |
Ok: this is fixable, and I will do so. However, this does change semantics of following case a bit:
which would formerly (before fix) use id Given this, I think I cannot change this in a patch but fix it for 2.19.0 (minor version). |
Amazing, thanks @cowtowncoder! |
@joaocanaverde-blue Thank you for your help here, good to have this edge case covered. |
Search before asking
Describe the bug
Trying to deserialise:
Results in:
Despite an empty string (
""
) being listed as a value in the enum.I'm trying to deserialise historical values, so this is a value I have to support. Ideally I'd still like to deserialise to an enum rather than just into a string, and would like to avoid coercion if possible.
Given that I'm specifying the empty string explicitly with
@JsonProperty(value = "")
, I'm assuming encountering this exception is a bug rather than intended behaviour?Version Information
2.18.2
Reproduction
Read:
into an
Example
object like:Expected behavior
Deserialisation works.
Additional context
A workaround does exist (as the exception message suggests):
The text was updated successfully, but these errors were encountered: