Arjix
Update the default validator to return custom error response
If performance and memory is important to you, then it's probably a "bad" solution, bc you are serializing/deserializing and serializing once again the response
Other than that, I see no downside
35 replies
Update the default validator to return custom error response
This may not have been useful for your particular issue since there was a better way, but it is useful if you want to apply transformations to the json response.
E.g. I use it to rename all
_id
to id
when returning data from mongodb
Should I have used DTOs instead? Yes
Am I working on a legacy backend? Also yes, so the least effort solution is the best, unless I want to rewrite a lot of code35 replies