Would an ObjectMapper#validate(Object)
method make sense?
#4980
knutwannheden
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
It might be useful, but I think the only viable universal implementation would simply be to serialize and then deserialize again. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I would not be very optimistic about feasibility of implementation (except by doing basic serialize-then-deserialize) although I can see why this would be desirable. But if anyone wants to try a PR, I'd be happy help. |
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
-
(I've seen #4482, but this seems to be slightly different, as I don't request support for any custom validations.)
I am using a custom
AnnotationIntrospector
with an override forhasRequiredMarker(AnnotatedMember)
. As far as I can tell this is checked when deserializing data, but not when serializing an object. What I would like to do is to be able to validate an object graph before serializing it, so I know that I will subsequently also be able to deserialize it again. I couldn't find anything that would allow me to do that, so I am wondering if it would make sense with some kind ofObjectMapper#validate(Object)
(orObjectMapper#validate(Object, TypeRef)
) method.Beta Was this translation helpful? Give feedback.
All reactions