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

Most upvoted comments

Do you think you’ll make it for 2.1

I’ll try to implement this soon. Maybe it will be two setup option:

  • Option will be encoded/decoded as array or as plain value. I’m not sure which behavior should be default
  • null will be decoded as Option.none() or as Option.some(null)