-
Notifications
You must be signed in to change notification settings - Fork 12
Validating against enum #44
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Currently, the best way to do this is the |
Where are the type hints documented? I don't recall seeing anything about arguments to the decorator |
Sorry, I misspoke - there are parameters that can be passed to the decorator, but those are to customize error handling. I meant to say the Currently in the midst of fleshing out and updating documentation in #45 , so that may help as well. |
Ah, I see. An example of usage would be great. I'll keep on eye on the docs. Looks good so far. |
An existing example would be in the unit tests: flask-parameter-validation/flask_parameter_validation/test/testing_blueprints/str_blueprint.py Line 74 in 7b99414
In addition to what's shown in that example, you can return a custom error message by returning a tuple of (valid: bool, error_message: str) instead of a single bool |
Is there a way to validate an argument to ensure that it has only a list of specific values?
For example
Or maybe validate against an existing Python enum
The text was updated successfully, but these errors were encountered: