Currently there is no documentation about how to register arrow's jackson integration. e.g. users should be made aware that they need to register the arrow module using mapper.registerArrowModule().
Might be useful to include this code in the top readme to make it immediately obvious.
val mapper = ObjectMapper()
.registerKotlinModule()
.registerArrowModule()
.setSerializationInclusion(JsonInclude.Include.NON_ABSENT) // enable this to omit serialization of Option.None
data class Foo(val value: Option<String>)
data class Bar(val value: Nel<String>)
mapper.writeValueAsString(Foo(none())) // {}
mapper.readValue("{}", Foo::class.java) // Foo(value=Option.None)
mapper.writeValueAsString(Foo("foo".some())) // {"value":"foo"}
mapper.readValue("""{"value":"foo"}""", Foo::class.java) // Foo(value=Option.Some(foo))
mapper.writeValueAsString(Bar("bar".nel())) // {"value":["bar"]}
mapper.readValue("""{"value":["bar"]}""", Bar::class.java) // Bar(value=NonEmptyList(bar))
mapper.readValue("""{"value":[]}""", Bar::class.java) // IllegalArgumentException: NonEmptyList cannot be empty
Currently there is no documentation about how to register arrow's jackson integration. e.g. users should be made aware that they need to register the arrow module using
mapper.registerArrowModule()
.Might be useful to include this code in the top readme to make it immediately obvious.