nadworny opened a new issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129


   # Description
   I have activated the `clientRequestValidation` and added 
`hibernate-validator` extension to 
[rest-json](https://github.com/apache/camel-quarkus-examples/tree/main/rest-json)
 example. When I send an invalid request, I'm not getting a `400` error code. 
Unless I misunderstood the validation feature? If so, any idea how to validate 
the request in a generic way for all the rest endpoints?
   
   # Expected behaviour
   I would expect the endpoint to return `400`.
   
   # Actual behaviour
   A `500` is returned.
   
   
   # How to reproduce
   Replace this line 
https://github.com/apache/camel-quarkus-examples/blob/b1352cd4c0d2a1b7b17ba73c3aca410f516d42f3/rest-json/src/main/java/org/acme/rest/json/Routes.java#L47
 with the following:
   ```java
   
restConfiguration().bindingMode(RestBindingMode.json).clientRequestValidation(true);
   ```
   
   Add a new test in the line 
https://github.com/apache/camel-quarkus-examples/blob/b1352cd4c0d2a1b7b17ba73c3aca410f516d42f3/rest-json/src/test/java/org/acme/rest/json/RestJsonTest.java#L56
 as follows:
   ```java
   /* Test validation */
   given()
           .body("{\"name2\": \"Pear\", \"description\": \"Winter fruit\"}")
           .header("Content-Type", "application/json")
           .when()
           .post("/fruits")
           .then()
           .statusCode(400);
   ```
   
   # Environment
   openjdk version "11.0.11" 2021-04-20
   macos 11.6 (20G165)
   https://github.com/apache/camel-quarkus-examples version: 
b1352cd4c0d2a1b7b17ba73c3aca410f516d42f3


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to