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

Add validation hook to route definition #21

Description

@pdiazvargas

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions