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

ObjectMapper config method (type MapperFeature) deprecation / documentation error #2402

Closed
gibbonsj opened this issue Aug 2, 2019 · 3 comments

Comments

@gibbonsj
Copy link

gibbonsj commented Aug 2, 2019

In version 2.10.0.pr1 the following code is deprecated:

ObjectMapper om = new ObjectMapper();
om.configure(MapperFeature.PROPAGATE_TRANSIENT_MARKER, true);

The documentation suggests using the following:

ObjectMapper.builder().disable(...)

but the builder function is not present. Not sure if this is related to #1954 or documentation drift. Any information or workaround about how to enable a MapperFeature in 2.10.0.pr1 would be appreciated.

@Alanscut
Copy link
Contributor

Alanscut commented Aug 3, 2019

hi, #1954 is not yet released. it shows in master branch:
release-notes/VERSION:
image

@cowtowncoder
Copy link
Member

Quick note: in addition to 3.0 vs 2.10 (which is true for many things -- builder() pattern actually was backported in 2.10), documentation should point to

JsonMapper.builder()

since although at some point the idea of adding builder onObjectMapper was considered it was difficult if not impossible to make it work properly with format-specific subtypes.

@gibbonsj
Copy link
Author

gibbonsj commented Aug 3, 2019

Thank you @cowtowncoder and @Alanscut.

Using JsonMapper worked. I will keep the issue open for tracking the documentation change per @cowtowncoder's comment above.

Pre-2.10.0 w/ ObjectMapper:

ObjectMapper om = new ObjectMapper();
om.setSerializationInclusion(Include.NON_NULL);
om.configure(MapperFeature.PROPAGATE_TRANSIENT_MARKER, true);

2.10.0 w/ JsonMapper:

JsonMapper jm = JsonMapper.builder()
.configure(MapperFeature.PROPAGATE_TRANSIENT_MARKER, true)
.serializationInclusion(Include.NON_NULL)
.build();

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

3 participants