You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a constraint violation, the error response generated by the ConstraintExceptionHandler always prepends the object and field name to the message. It would be nice to be able to control whether or not that prepending happens, either globally or per message (if that's even possible).
For example, instead of a message such as:
"message": "requestModel.firstName: First name must not be empty"
Just display this:
"message": "First name must not be empty"
I was able to work around this by creating my own class that @Replaces the ConstraintExceptionHandler and removing the code doing the prepending, but I am sure there's more flexible ways to do this, i.e. configuration-based properties.
The text was updated successfully, but these errors were encountered:
altro3
added a commit
to altro3/micronaut-validation
that referenced
this issue
Nov 12, 2024
Feature description
Given a constraint violation, the error response generated by the
ConstraintExceptionHandler
always prepends the object and field name to the message. It would be nice to be able to control whether or not that prepending happens, either globally or per message (if that's even possible).For example, instead of a message such as:
Just display this:
I was able to work around this by creating my own class that
@Replaces
theConstraintExceptionHandler
and removing the code doing the prepending, but I am sure there's more flexible ways to do this, i.e. configuration-based properties.The text was updated successfully, but these errors were encountered: