Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Add validation hook to route definition #21

Open
pdiazvargas opened this issue Mar 31, 2019 · 0 comments
Open

Add validation hook to route definition #21

pdiazvargas opened this issue Mar 31, 2019 · 0 comments

Comments

@pdiazvargas
Copy link
Contributor

What

I want to have the ability to validate a request before my view gets executed. The validator's only responsibility would be that of making sure that the payload of the request is valid. Also, the validator should have access to the route, headers...

@app.route('/users', methods=['POST'], validator=UserValidator())
def create_users():
    created_users = get_created_users(app.request.json_body)
    return [u.to_dict() for u in created_users]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant