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'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:
{ "example": "" }
into an Example object like:
data class Example(
val example: YesOrNo
)
enum class YesOrNo(val value: kotlin.String) {
@JsonProperty(value = "")
EMPTY(""),
@JsonProperty(value = "yes")
YES("yes"),
@JsonProperty(value = "no")
NO("no");
}
Expected behavior
Deserialisation works.
Additional context
A workaround does exist (as the exception message suggests):
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: