Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jackson support for Option seems to not work? #1105

Open
OOPMan opened this issue Jan 13, 2021 · 1 comment
Open

Jackson support for Option seems to not work? #1105

OOPMan opened this issue Jan 13, 2021 · 1 comment

Comments

@OOPMan
Copy link

OOPMan commented Jan 13, 2021

Describe the bug
My object mapper is configured as so:

ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new CyclopsModule());
objectMapper.registerModule(new Jdk8Module());

I have a class defined as follows:

class A {
   public int someField = 0;
}

class B {
   public Option<A> child = Option.none();
}

When I serialize an instance of B I get JSON like:

{
 "child": null
}

When I attempt to deserialize the JSON produced I get an exception:

Exception in thread "main" com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot find a Value deserializer for abstract type [reference type, class cyclops.control.Option<my.package.A><[simple type, class my.package.A]>]

To Reproduce
Described above

Expected behavior
JSON serialization AND deserialization should work...

@johnmcclean
Copy link
Member

Deserialization stopped working with later versions of Jackson-databind. 10.4.1 supports the latest versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants