-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
marshmallow-dataclass is not compatible with marshmallow 4.0.0. Here is a dataclass that fails with marshmallow 4.0.0:
@mmd.dataclass(frozen=True)
class Document:
...
partnernummer: str | None = field(default=None, metadata={"is_partner_field": True})
...
This raises an exception when loading a calling Schema().load():
/code/venv/lib/python3.12/site-packages/marshmallow_dataclass/lazy_class_attribute.py:36: in __get__
setattr(cls, self.name, self.func())
/code/venv/lib/python3.12/site-packages/marshmallow_dataclass/__init__.py:464: in class_schema
return _internal_class_schema(clazz, base_schema)
/code/venv/lib/python3.12/site-packages/marshmallow_dataclass/__init__.py:571: in _internal_class_schema
attributes.update(
/code/venv/lib/python3.12/site-packages/marshmallow_dataclass/__init__.py:574: in <genexpr>
_field_for_schema(
/code/venv/lib/python3.12/site-packages/marshmallow_dataclass/__init__.py:919: in _field_for_schema
union_field = _field_for_union_type(typ, base_schema, **metadata)
/code/venv/lib/python3.12/site-packages/marshmallow_dataclass/__init__.py:765: in _field_for_union_type
return _field_for_schema(
/code/venv/lib/python3.12/site-packages/marshmallow_dataclass/__init__.py:862: in _field_for_schema
return field(**metadata)
E TypeError: Field.__init__() got an unexpected keyword argument 'is_partner_field'
Also, when dumping a dataclass i get another exception (Unfortunately no stack trace here):
dumped = Document.Schema().dump(document)
E TypeError: 'str' object is not callable
Marshmallow release notes for 4.0.0 are here: https://marshmallow.readthedocs.io/en/latest/changelog.html#id2
Metadata
Metadata
Assignees
Labels
No labels