When setting up the requestBody validation, is there any way to return the defined 400 response object instead of the text/plain with the json validation info?
In the following example:
But with a different client_secret other than the one defined in the schema enum I get:
curl -X POST -H 'Content-Type:application/json' -H 'Accept-Type:application/json' -i http://localhost:19999/api/3.1/login/ \
-d '{"client_id":"my_client_id", "client_secret": "invalid_secret"}'
HTTP/1.1 400 Bad Request
Access-Control-Allow-Origin: *
Date: Sun, 22 Dec 2019 21:58:47 GMT
Content-Length: 271
Content-Type: text/plain; charset=utf-8
Request body has an error: doesn't input the schema: Error at "/client_secret":JSON value is not one of the allowed values
Schema:
{
"description": "Client secret",
"enum": [
"very_secret_secret"
],
"type": "string"
}
Value:
"invalid_secret"
while what I would really like was the object I defined, i.e.:
{
"message": "Blablabla, bad request",
"documentation_url": "http://blabla.com"
}
Do you have any idea how I could achieve this? Thank you.
Hi,
When setting up the
requestBody
validation, is there any way to return the defined 400 response object instead of the text/plain with the json validation info? In the following example:I get the expected 200 OK with:
But with a different
client_secret
other than the one defined in the schemaenum
I get:while what I would really like was the object I defined, i.e.:
Do you have any idea how I could achieve this? Thank you.