You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/09/23 16:31:57 UTC

[GitHub] [camel-quarkus] nadworny opened a new issue #3129: clientRequestValidation not working with camel REST DSL

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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus edited a comment on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus edited a comment on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-930878186


   Yeah its in the upcoming Camel 3.12.0 release, however camel-quarkus then need to pickup this Camel release and do a camel-quarkus release too ;)


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-927691637


   So its working as designed, to get an error code for invalid parsing json data, then you can use onException and set the http error code you want.


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus closed issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus closed issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129


   


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-930878186


   Yeah its in the upcoming Camel 3.12.0 release


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] nadworny commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
nadworny commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-930201671


   Thanks @davsclaus. I see that the jira issue is resolved. Can I test it in this case?


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-927707767


   We can likely improved this
   https://issues.apache.org/jira/browse/CAMEL-17006


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] ppalaga commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-927603893


   It sounds like this is not Camel Quarkus specific behavior. 
   @davsclaus is the REST DSL request validation also expected to cover the situation when the json body cannot be deserialized to the requested Java type (like here due to a misspelled json attribute)?


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-968351536


   Closing as latest camel-quarkus is upgraded to Camel 3.12


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-927689918


   No the request validation is only to match the Content-Type and Accept HTTP headers that the client send to Camel, and if they is accepted in the Rest DSL, where you can configure what a REST path supports.
   
   This validator does not touch the message body/payload.


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] davsclaus commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-927691295


   And also if there are missing body / query parameters if they were set to be required in the Rest DSL


-- 
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-unsubscribe@camel.apache.org

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



[GitHub] [camel-quarkus] nadworny commented on issue #3129: clientRequestValidation not working with camel REST DSL

Posted by GitBox <gi...@apache.org>.
nadworny commented on issue #3129:
URL: https://github.com/apache/camel-quarkus/issues/3129#issuecomment-930201671


   Thanks @davsclaus. I see that the jira issue is resolved. Can I test it in this case?


-- 
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-unsubscribe@camel.apache.org

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