You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/21 09:02:51 UTC

[GitHub] [apisix] tinpad opened a new issue #5108: request help: Curtomized response message in request-validation plugin

tinpad opened a new issue #5108:
URL: https://github.com/apache/apisix/issues/5108


   ### Issue description
   
   I am enabling the request-validation plugin on a route
   
   curl http://127.0.0.1:9080/apisix/admin/routes/35 -H 'X-API-KEY: xxxxxxxxxxxxxxxxxxx' -X PUT -d '
   {
       "uri": "/products/create",
       "plugins": {
           "request-validation": {
               "body_schema": {
                   "type": "object",
                   "required": ["productName", "price"],
                   "properties": {
                       "productName": {"type": "string"},
                       "price": {"type": "number"}
                   }
               }
           }
       },
       "upstream": {
           "service_name": "PRODUCTSSERVICE",
           "type": "roundrobin",
           "discovery_type": "eureka"
       }
   }'
   
   When I test it using following command - 
   curl http://127.0.0.1:9080/products/create  -X POST -d '{"product-Name":"Laptop","pri-ce":12345.00}'
   
   I receive the below message - 
   property "price" is required
   
   Can we change this default message with a customized json response
   
   ### Environment
   
    apisix version (cmd: apisix version): 2.8
    OS (cmd: uname -a): 20.04.1-Ubuntu
    OpenResty / Nginx version (cmd: nginx -V or openresty -V): openresty/1.19.3.2
    etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API): 3.4.0
    apisix-dashboard version, if have: NA
    the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
    uarocks version, if the issue is about installation (cmd: luarocks --version): 3.4.0


-- 
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: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tokers commented on issue #5108: request help: Curtomized response message in request-validation plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #5108:
URL: https://github.com/apache/apisix/issues/5108#issuecomment-923792484


   @tinpad Currently, a field like `rejected_message` is missing, we may add such a field to support the demand.


-- 
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: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander closed issue #5108: request help: Curtomized response message in request-validation plugin

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #5108:
URL: https://github.com/apache/apisix/issues/5108


   


-- 
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: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander closed issue #5108: request help: Curtomized response message in request-validation plugin

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #5108:
URL: https://github.com/apache/apisix/issues/5108


   


-- 
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: notifications-unsubscribe@apisix.apache.org

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