Closed adamkorynta closed 1 week ago
I missed that your previous Format changes slipped in a validate call. I'm hesitant.
I struggle a little with the purpose of the validate() method. It seems to be designed to ensure that the client's payload deserializes to a working DTO. In which case I do think we need to call it on all deserialization in the Formats class. I didn't see any references to the validate() getting called prior to serialization going back to the client (might be a good idea?). It seems like we should just build it into the serialization through annotations somehow....
An annotation to mark fields as "required for operation" seems like a good idea, just a lot of effort.
The basic idea was enough validation for user provided data to meet minimum requirements if easily known and would save a lot of time going to the database. If the database fails quickly it's not a huge deal.
But since we're using the ObjectMapper more and we can get an object schema, I think Adam is right that validation function isn't as useful as it was in the past.
Or it might have been to handle those field exceptions better.
the Formats deserialization process handles the validate call of content received from the client