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
The library currently breaks for dataclasses with fields of type Optional[List[X]], returning the following error:
File "dcj_bug/ex.py", line 66, in <module>
Adult.schema().loads(test3, many=True) # Fail
File "<home_path>/.cache/pypoetry/virtualenvs/dcj-bug-py3.7/lib/python3.7/site-packages/dataclasses_json/api.py", line 100, in schema
infer_missing)
File "<home_path>/.cache/pypoetry/virtualenvs/dcj-bug-py3.7/lib/python3.7/site-packages/dataclasses_json/mm.py", line 86, in _make_default_fields
cls)
File "<home_path>/.cache/pypoetry/virtualenvs/dcj-bug-py3.7/lib/python3.7/site-packages/dataclasses_json/mm.py", line 103, in _make_default_field
cons = _type_to_cons[cons_type]
KeyError: typing.List[__main__.Child]
I've attached some code below that demonstrates the issue.
Please let me know if there's any information or assistance I can provide; I dug into the code a bit in mm.py where it's breaking, but wasn't able to figure out what the correct logic should be in mm._make_default_field.
Summary
The library currently breaks for dataclasses with fields of type Optional[List[X]], returning the following error:
I've attached some code below that demonstrates the issue.
Please let me know if there's any information or assistance I can provide; I dug into the code a bit in mm.py where it's breaking, but wasn't able to figure out what the correct logic should be in mm._make_default_field.
Example
The text was updated successfully, but these errors were encountered: