Context: When a request object has a field like Integer, but an empty/blank string is given, then Jackson deserializes this value as null.
When deserializing the empty/blank string into something like Optional<Integer>, then this will result in a value of Optional.empty(), not null.
The behavior of JsonNullable is inconsistent here: When using JsonNullable<Integer>, an empty/blank string will be deserialized as JsonNullable.undefined() (=not provided in the request) instead of JsonNullable.of(null) (=provided, but a null value).
I think, the best behavior here should be, that empty/blank strings should be deserialized as JsonNullable.of(null), not JsonNullable.undefined()
Context: When a request object has a field like
Integer, but an empty/blank string is given, then Jackson deserializes this value asnull.When deserializing the empty/blank string into something like
Optional<Integer>, then this will result in a value ofOptional.empty(), notnull.The behavior of JsonNullable is inconsistent here: When using
JsonNullable<Integer>, an empty/blank string will be deserialized asJsonNullable.undefined()(=not provided in the request) instead ofJsonNullable.of(null)(=provided, but a null value).I think, the best behavior here should be, that empty/blank strings should be deserialized as
JsonNullable.of(null), notJsonNullable.undefined()