pallets-eco / wtforms

A flexible forms validation and rendering library for Python.
https://wtforms.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.51k stars 395 forks source link

Make Optional check on field.data instead of field.raw_data #843

Open antonstakhouski opened 6 months ago

antonstakhouski commented 6 months ago

When form is submitted via JSON and data is set using field.process(None, data), Optional always stops the validation chain, because it checks only field.raw_data which will always be None.

Fix for issue #842 .

Optional validator should check field.data to validate fields correctly.