Prevent deserialization of "" as null
for Duration
, Instant
, LocalTime
, OffsetTime
, and YearMonth
in "strict" (non-lenient) mode
#138
Labels
active
Issue being actively investigated and/or worked on
For the java.time classes Duration, Instant, LocalTime, OffsetTime and YearMonth, an empty string is mapped to null by the associated deserializer, for example DurationDeserializer, InstantDeserializer, etc. So something like {"date": null} can't be distinguished from {"date": ""}. From the view of a strict API, the latter is an error.
It would be good to add some feature to treat empty string as invalid format, so that the associated deserializer (DurationDeserializer, etc) could report this as an error instead of mapping to null. This capability should be noted in the documentation.
This issue is related to issue #114 which was fixed for LocalDate and LocalDateTime. However, the fix is still required for the java.time types listed here.
The text was updated successfully, but these errors were encountered: