flask-pydantic
flask-pydantic copied to clipboard
Validate request.form arguments from HTML post form
Hi,
not sure whether there is an option to validate request.form
arguments right now, with this package but it would be a nice-to-have feature :)
For example, to use like this:
@validate(form=SomeModel)
Right now, I am validating request.form simply like this:
try:
form = LoginFormModel(**request.form)
except ValidationError as ve:
return {"validation_error": ve.errors()}, 400
Or is there any other way around?
Any advice would be much appreciated!
Hello,
this would indeed be a nice feature. This package does not support forms yet. I will try to find time to implement it. Feel free to submit PR.
Thank you for suggestion!