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
Recently we changed a type in one object from JsonNullable<String> sth = JsonNullable.undefined() to JsonNullable<Character> sth = JsonNullable.undefined(). Soon after we noticed a change in the deserialisation behaviour - explicit updates of that property to an empty string ("") no longer worked, as they were treated as not present (JsonNullable.undefined instead of JsonNullable[null]).
It seems that the issue is in the JsonNullableDeserializer, namely in the constructor:
Does it make sense to change the check and include Character as well as String? Or would you suggest another alternative? If it is the former, we can also open a PR, as the change doesn't seem so large (and there is already #4 for inspiration).
The text was updated successfully, but these errors were encountered:
I think the Problem is, that a Character can only be set or null, there is nothing like an empty value. Furthermore, there is no such json type like a single character. JSON only knows about Boolean, Numbers, Strings, Arrays, Lists and an object consiting of these. A single character is basically just a number. When you deserialize a string value to a character via jackson, it's some kind of implicit / convenience conversion and just works although it's not really defined by the json standard.
I think what you would like to achieve can only be made by using JsonNullable<Integer> with:
0 == empty()
null = undefined()
any other
If you need an char, you can just cast the integer prior using it.
After thinking about this issue, I think it's best to align the deserialization behaviour for String and Character to make it more consistent. See PR #45.
Recently we changed a type in one object from
JsonNullable<String> sth = JsonNullable.undefined()
toJsonNullable<Character> sth = JsonNullable.undefined()
. Soon after we noticed a change in the deserialisation behaviour - explicit updates of that property to an empty string ("") no longer worked, as they were treated as not present (JsonNullable.undefined
instead ofJsonNullable[null]
).It seems that the issue is in the
JsonNullableDeserializer
, namely in the constructor:Does it make sense to change the check and include
Character
as well asString
? Or would you suggest another alternative? If it is the former, we can also open a PR, as the change doesn't seem so large (and there is already #4 for inspiration).The text was updated successfully, but these errors were encountered: