I used swagger-codegen to build a service api in javascript. When the call works it returns my custom defined type and status 200, but when there is a validation error it returns an error but also a status 200.
For example:
{
"message": "Request validation failed: Parameter (model) is required",
"code": "REQUIRED",
"failedValidation": true,
"path": [
"paths",
"/make/ford",
"get",
"parameters",
"0"
],
"paramName": "model"
}
I would expect it to return status code 400 as my swagger.yml only specifies my user defined type as a response. How can I make the generated code return status 400 for validation errors?
via BeWarned
No comments:
Post a Comment