Skip to content

ExceptionMapper not being called when using @Valid with hibernate validator in REST endpoints #41102

Open

Description

Describe the bug

This used to work and not sure when it stopped working, but I have code that uses the @Valid annotation to validate incoming JSON objects in my rest endpoints.

I also have a custom exception mapper which handles the ConstrainValidation exception and formats the message nicely.

In Quarkus 3.11.1 this no longer gets triggered when I send in a bad value for my json object.

I am getting a generic Constraint validation message now.

I noticed this in my real code so I added a test case to my demo code for this bug.

In this test code, I simply have a ExceptionMapper with a log statement, it never gets triggered.

My real mapper would then process an instance of ConstraintValidationException and proceed.

Test:
https://github.com/tmulle/quarkus-exception-mapper-test.git

Try to POST to http://localhost:8080/hello/validator with a JSON payload of {"someItem":""} and you'll see the exception mapper not print out its log statement but you are returned a constraint message.

Did something change? was there a migration note I missed?

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

MacOS/Linux

Output of java -version

JDK17

Quarkus version or git rev

3.11.1

Build tool (ie. output of mvnw --version or gradlew --version)

maven

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions