Is it possible to extend the default deserializers behavior through BeanDeserializerModifier? #262
Unanswered
KasperWolsink99
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Use of Not all deserializers rely on Not sure if this is the issue you have, but it is a common problem. |
Beta Was this translation helpful? Give feedback.
2 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.
-
Hi all,
I am using Jackson with Kotlin and have some mechanism in place that deserializes JSON to Kotlin data classes.
This works fine, but what I am trying to do is extend the deserializer used in my context to first check if the JSON contains all non-nullable fields of the data class, and if it doesn't throw an exception containing all missing fields.
So, what I am trying to do is have some custom validation logic trigger just before deserialization.
I dug a bit, and came up with the following idea:
This however, does not work:
I have replaced my custom logic with a comment, this to illustrate that even omitting any logic and just simply returning a deserializer that delegates to
modifiedDeserializer
fails. Clearly wrapping the deserializer with a custom one is the wrong approach.I am wondering why exactly this doesn't work, if I am on the right track or if I should consider a different way?
Beta Was this translation helpful? Give feedback.
All reactions