Add a converter for Vavr's Option that behaves more like one would expect: if a value is not present or null, convert to None, otherwise to Some. The current implementation in gson-vavr uses a list. While this strategy does have its point (you can express Some(null)), it's really not what most people probably expect. I've never seen this way of mapping Option in the wild, so for interoperability, you currently have to use java.util.Optional.
As a first step, just add this converter to the codec library. Also consider proposing this change to vavr-gson.
Add a converter for Vavr's
Option
that behaves more like one would expect: if a value is not present ornull
, convert toNone
, otherwise toSome
. The current implementation in gson-vavr uses a list. While this strategy does have its point (you can expressSome(null)
), it's really not what most people probably expect. I've never seen this way of mappingOption
in the wild, so for interoperability, you currently have to usejava.util.Optional
.As a first step, just add this converter to the codec library. Also consider proposing this change to vavr-gson.