Blank strings should not be deserialized as JsonNullable.undefined() #125 - #152
Blank strings should not be deserialized as JsonNullable.undefined() #125#152joshuabrandes wants to merge 1 commit into
Conversation
|
I read the full diff and ran this branch locally: What this gets right, and it is the easy thing to get wrong here: since #117 split the deserializer into a Jackson 2 and a Jackson 3 implementation, any behaviour change has to be applied twice. This PR removes the empty-string branch symmetrically from both Three things I would want resolved before this merges. 1. @Override
public Object getEmptyValue(DeserializationContext ctxt) {
return JsonNullable.undefined();
}while static class Bean {
@JsonSetter(nulls = Nulls.AS_EMPTY)
public JsonNullable<Integer> value = JsonNullable.undefined();
}
// {"value":null} -> JsonNullable.undefined (getEmptyValue)
// {"value":""} -> JsonNullable[null] (new behaviour)So a user who opted into 2. 3. Release line and collision with #126. This is an unconditional behaviour change with no opt-out, on the 0.2.x line, and there is no README or changelog note. Anyone deserializing |
addresses #125
@wing328 I hope that works for you. If you want any changes, please let me know.
Summary by cubic
Blank strings now deserialize to
JsonNullable.of(null)(present null) instead ofJsonNullable.undefined()for non-String types. Fixes #125 and aligns behavior with default deserialization.JsonNullableJackson2DeserializerandJsonNullableJackson3Deserializerto let blank strings coerce to null.JsonNullable.of(null)for empty or whitespace strings; missing fields still yieldJsonNullable.undefined().Written for commit 75b6cea. Summary will update on new commits.