Mashumaro

Latest version: v3.15

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 10 of 12

1.15

Fix for derived data classes with fields and default_factory in ancestors

In the previous versions if a data class had been derived from another data class with a default_factory, `MissingField` would have been raised on instantiation without field value provided as it shown in the following example:

python
dataclass()
class A(DataClassJSONMixin):
foo: List[str] = field(default_factory=list)

dataclass()
class B(A):
pass

print(B.from_dict({})) MissingField: Field "foo" of type typing.List[str] is missing in __main__.B instance


Thanks to ian-sentropy who found this bug.

1.14

Features
--------
* Support Python 3.9

1.13

Fix for custom Enum serializable classes

In the version `1.12` if you inherit both `Enum` and `SerializableType` classes you will get an exception `TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases` like in the following example:

python
class Example(IntEnum, SerializableType):
A = 1
B = 2

def _serialize(self):
return {"value": self.name}

classmethod
def _deserialize(cls, value):
return Example.__members__[value["value"]]

1.12

Fix for derived data classes without annotations

In the version `1.11` if a data class without annotations had been derived from another data class, `KeyError` would have been raised as it shown in the following example:

python
dataclass
class A:
a: int

dataclass
class B(A, DataClassDictMixin):
pass

...
KeyError: '__annotations__'

1.11

Fix constructing data class instances with inherited default values

In the previous versions there was a problem in case one data class is derived from another data class that have default values. If any ancestor had had a field with a default value, constructing an instance from a dictionary without that field would've been failed as it shown in the following example:

python
dataclass
class A:
a: int
b: int = 123

dataclass
class B(A, DataClassDictMixin):
c: int = 456

B.from_dict({'a': 111, 'c': 222}) mashumaro.exceptions.MissingField: Field "b" of type builtins.int is missing in __main__.B instance

1.10

Features
--------
* Add support for classes implementing the `os.PathLike` interface

Page 10 of 12

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.