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
Using an optional field with any custom marshmallow field class cause desert to crash on de-serialization. E.g. a field with b: Optional[B] = desert.ib(BField(), default=None) does not work.
A(a=42, b=None)
{'a': 42, 'b': None}
Traceback (most recent call last):
File "C:\Svein\Prosjekt\elns\__work\desertbug.py", line 24, in <module>
a2 = s.load(d)
File "C:\Svein\Prosjekt\elns\venv\lib\site-packages\marshmallow\schema.py", line 717, in load
return self._do_load(
File "C:\Svein\Prosjekt\elns\venv\lib\site-packages\marshmallow\schema.py", line 900, in _do_load
raise exc
marshmallow.exceptions.ValidationError: {'b': ['Field may not be null.']}
The text was updated successfully, but these errors were encountered:
I.e. when using custom fields, one must manually declare if the field can be none. The typehint Optional[B] is ignored. So is the consequence of using a custom field that it voids the desert-ness?
Using an optional field with any custom marshmallow field class cause desert to crash on de-serialization. E.g. a field with
b: Optional[B] = desert.ib(BField(), default=None)
does not work.This results in:
The text was updated successfully, but these errors were encountered: