Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict Response Validation doesn't enforce status codes from schema #1901

Open
mjmccain52 opened this issue Mar 22, 2024 · 0 comments
Open

Comments

@mjmccain52
Copy link

Description

Our openapi schema had for a certain endpoint defined expected responses for 201, 400, 401, and 500 status codes.
The 201 was actually a copy paste typo, and we were returning a 200.
Because the schema for 200 was undefined, no validation occurred.
Strict validation and Response validation were both set to true.

Expected behaviour

An undocumented status code should result in validation failure and a 500

Actual behaviour

An undocumented status code skips response validation

Steps to reproduce

  • Create a connexion flask app configured with both strict_validation and validate_responses set to True, and also using an openapi.yaml schema
  • inside the schema, define a basic endpoint path with a acceptable responses set to 201 and create a basic schema to validate
  • inside the flask app, have the endpoint return a response body that breaks the schema, but with a 200 status code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant