Skip to content

v1.11

Compare
Choose a tag to compare
@Fatal1ty Fatal1ty released this 12 Dec 21:56
· 1086 commits to master since this release

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:

@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