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

Validate responses as well as requests #29

Open
mst-ableton opened this issue Oct 2, 2019 · 3 comments
Open

Validate responses as well as requests #29

mst-ableton opened this issue Oct 2, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@mst-ableton
Copy link
Contributor

It would be nice for quart-openapi to validate responses against the response schema as well as requests against the request schema. Right now, response validators can be added for documentation purposes only. Ideally, the server would 500 upon validation error.

@zeroshade
Copy link
Contributor

Hmm, I don't know how much I like this idea solely that I believe it would be the responsibility of the person building the service to ensure their responses follow their own schema but probably don't want to have their service suddenly 500 or otherwise fail if they screwed up their schema or their response in a given scenario. I'd rather err towards flexibility on that end.

That said, maybe adding an option in which a consumer can turn on this sort of validation against responses so a user can enable it understanding the risks might make sense. I'll see what I can come up with (or you're welcome to contribute if you like!)

@zeroshade zeroshade added the enhancement New feature or request label Oct 4, 2019
@andreykurilin
Copy link

One of the possible use-cases is testing purpose (ensuring that documentation is correct).

PS: flask-restplus validates both requests and responses when validate=True is configured.

@zeroshade
Copy link
Contributor

Fair point, I'll put it on my list and try to get to adding this functionality in the next couple weeks. If anyone wants, feel free to file a PR adding it yourself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants