express-openapi-validator
express-openapi-validator copied to clipboard
Response validation not working in 1-standard example
Describe the bug Matching response status codes from the spec appear not to be working or too forgiving?
To Reproduce
- Edit the
api.yaml
in1-standard
example, changing/ping
response status code from 200 to any other status code. - Run the example.
-
curl
the/v1/ping
endpoint. - Observe it succeed.
-
curl
the/spec
endpoint to confirm edit if you like.
Actual behavior Success!
Expected behavior Validation error, response status code not defined.
Examples and context
I tried this with master
branch and v4.12.7
tag, same result.
@shousper thanks for the issue.
note, if the code and spec are out of sync, you will get a validation error. for example, if the code is was modified to respond with a 201
, but the spec still only defines a 200, then the validator will return a validation error.
closing this out for now. please reopen if the code and spec match and the error occurs. also, a code snippet will be super helpful. thanks!
note, if the code and spec are out of sync, you will get a validation error.
This is exactly the problem. It does NOT produce a validation error when the code & spec are out of sync.
ah gotcha. i misread. reopening