Replies: 1 comment
-
|
Okay, I think I mostly figured it out, but there's a few corner cases that it doesn't work as well for. I extended The two corner cases that I'm not quite happy with are:
https://gist.github.com/xpdota/d242294a8499d69e28590eb9dbe842af |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a fairly typical implementation:
@JsonTypeInfoto add a "type" property to differentiate between different typesList<ParentType>.Everything so far works fine, but what I want to add is:
JsonNodeor just a string representation of the JSON that failed to deserialize.My first thought was to use a
DeserializationProblemHandler, however, this really only catches common issues at the same level. That is, if the issue occurs in a nested object, it's not of much help. I want it to be a catch-all for anything that happens below this level (though there is a possibility of having aParentTypewithin anotherParentType, in which case I would want it to be caught by the deepestParentType).I tried playing around with a custom
ValueDeserializer, or extendingStdDeserializer, but the problem is that no matter what I tried, any attempt to get it to perform the "normal" deserialization logic (so that I can catch an error) would result in a stack overflow, as my custom deserializer would effectively just call itself. I also tried things withcreateContextual()to no avail (findRootValueDeserializer/findContextualValueDeserializer produces the stack overflow instead). I haven't been able to make this work on Jackson 2 nor 3. I also played around with customTypeIdResolvers, but this also lead to either stack overflows, or other breakages.What I'm looking for is:
Here is an example of what I asm trying to accomplish. The two serialization tests work fine, but none of the deserialization test cases work - they all stack overflow: https://gist.github.com/xpdota/83e9c1f9d9a36ba8b1576f40ba489e27
Thank you for any help.
Beta Was this translation helpful? Give feedback.
All reactions