-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add failing test for #4047 #4049
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
Add failing test for #4047 #4049
Conversation
ObjectMapper.valueToTree
ignores SerializationFeature.WRAP_ROOT_VALUE
)} | ||
|
||
|
||
public void testTreeToValue() throws Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc
*/ | ||
UNWRAP_MAPPER.readTree(WRAPPED_EVENT_JSON); | ||
UNWRAP_MAPPER.readTree(UNWRAPPED_EVENT_JSON); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When DeserializationFeature.UNWRAP_ROOT_VALUE
is enabled, readTree()
works like
UNWRAP_MAPPER.readValue(WRAPPED_EVENT_JSON, JsonNode.class);
But, should it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is tricky: my thinking all along has been that no, WRAP/UNWRAP related to POJOs and should not affect JsonNode
: JsonNode
(tree model in general) being used to represent JSON exactly as is, with no (or minimal) translations: no naming conventions, no ignorals... and hence no wrapping/unwrapping.
But then again some users disagree, and maybe more importantly, implementation may be such that wrapping/unwrapping occurs outside control of (de)serializer being used.
I suspect this could actually be one reason for handling of:
mapper.readTree(source);
mapper.readValue(source, JsonNode.class);
to possibly differ.
…alueToTree-will-ignore-the-configuration-SerializationFeature.WRAP_ROOT_VALUE-
Could this be merged with PR #4050 ? |
@cowtowncoder sure. Will do. Plain merge or exclude some? |
Maybe copy ones relevant to initial case, Maybe follow-up issue/PR for |
EDITED |
Closingas per notes above #4049 (comment) |
Reproduces #4047