You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a request sample below, where null is passed for the field, it returns error. Optional should also stop the validation chain from continuing for null values, as well.
{
"public_qr_id":null
}
Error:
Python312\Lib\uuid.py", line 172, in __init__
raise TypeError('one of the hex, bytes, bytes_le, fields, '
TypeError: one of the hex, bytes, bytes_le, fields, or int arguments must be given
Environment
Python version: 3.12.1
wtforms version:3.1.2
The text was updated successfully, but these errors were encountered:
Optional only applies to formdata and that is intentional, see my previous reply to a similar issue: #842 (comment)
If you find yourself running validate() without first passing formdata you are doing something inherently incorrect and unsupported. If you want to validate data or obj, then you should use something like pydantic.
If you were hell-bent on it you could get WTForms to do it if you write your own validators, but it's not designed for it, so I honestly wouldn't recommend trying it, it will not be reliable. WTForms assumes valid object data.
For a request sample below, where null is passed for the field, it returns error. Optional should also stop the validation chain from continuing for null values, as well.
{
"public_qr_id":null
}
Error:
Environment
The text was updated successfully, but these errors were encountered: