Replies: 1 comment
-
There is probably no strict reason for So I'd be ok in removing As to validation, I don't think there is any good hooks to add this in: this should not require sub-classing of serializers. But there is also the problem of requiring more metadata as context that may not be easy to solve. Overall I think currently validation is best run separate from deserialization; but I'd be open to adding additional support for in-flow extension points. But I probably won't have time driving such efforts; can and will help as usual. |
Beta Was this translation helpful? Give feedback.
-
I am attempting to enforce JSR-380 validation after deserialization and before serialization without having a custom deserializer and serializer for each class. This is achievable before deserialization as shown in this baeldung article. Taking the same approach with serialization does not work because BeanSerializer.serialize is final.
A few questions:
Below is an example project showing this with two unit tests. Deserialization passes and serialization fails because serialization is not configured for validation.
sample project
Beta Was this translation helpful? Give feedback.
All reactions