Closed Garcel closed 2 years ago
feat: allow passing a validator function to perform complex or customized validations on parameters.
Example:
NEIGHBORHOODS = { 1: {'id': 1, 'name': 'Birloque'} } def is_valid_neighborhood_id(id: int) -> bool: return id in NEIGHBORHOODS @app.route('/neighborhood/<int:id>', methods=['GET']) @ValidateParameters() def get_neighborhood(id: int = Route(func=is_valid_neighborhood_id)): return NEIGHBORHOODS.get(id)
Looks great, thank you for the PR!
feat: allow passing a validator function to perform complex or customized validations on parameters.
Example: