Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In ConstraintExceptionHandler, allow disabling of prepended object/property name #286

Open
wmunyan opened this issue Jan 17, 2024 · 0 comments · May be fixed by #449
Open

In ConstraintExceptionHandler, allow disabling of prepended object/property name #286

wmunyan opened this issue Jan 17, 2024 · 0 comments · May be fixed by #449

Comments

@wmunyan
Copy link

wmunyan commented Jan 17, 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:

"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.

altro3 added a commit to altro3/micronaut-validation that referenced this issue Nov 12, 2024
altro3 added a commit to altro3/micronaut-validation that referenced this issue Nov 12, 2024
altro3 added a commit to altro3/micronaut-validation that referenced this issue Nov 12, 2024
altro3 added a commit to altro3/micronaut-validation that referenced this issue Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant