vavr-jackson: Option: undefined gets deserialized as null
If I add this test to OptionTest.java, I get a test fail:
private static class SimpleObject {
public Option<Integer> value;
}
@Test
public void testUndefinedDeserialization() throws IOException {
SimpleObject restored = mapper().readValue("{}", SimpleObject.class);
Assert.assertEquals(Option.none(), restored.value);
}
In other words, undefined gets deserialized to nullinstead of the expected Option.none(). That’s a major setback, but then I have no idea whether jackson would allow to fix that.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- Option.some(null) & Option.none() serialization #57 — committed to ruslansennov/vavr-jackson by ruslansennov 10 years ago
- Merge pull request #60 from ruslansennov/master Option.some(null) & Option.none() serialization #57 — committed to vavr-io/vavr-jackson by ruslansennov 10 years ago
- Option encode/decode mode #57 — committed to ruslansennov/vavr-jackson by ruslansennov 10 years ago
- Merge pull request #61 from ruslansennov/master Option encode/decode mode #57 — committed to vavr-io/vavr-jackson by ruslansennov 10 years ago
I’ll try to implement this soon. Maybe it will be two setup option:
Optionwill be encoded/decoded as array or as plain value. I’m not sure which behavior should be defaultnullwill be decoded asOption.none()or asOption.some(null)