Skip to content

Releases: Fatal1ty/mashumaro

v1.18

04 Jan 13:44
Compare
Choose a tag to compare

Changes

  • Fixed weird TypeError exception that was thrown instead of MissingField in case when field doesn't have default argument
  • Added ability to change deserialization method with metadata argument. See here for details.

v1.17

22 Dec 09:58
Compare
Choose a tag to compare

Changes

  • Support for all types from pathlib
  • Variable annotated with a class derived from os.PathLike will be deserialized into an instance of that class
  • Variable annotated with os.PathLike will be deserialized into an instance of PurePath class: PurePosixClass on posix, PureWindowsPath in windows

v1.16

18 Dec 22:10
Compare
Choose a tag to compare

Changes

  • Raise InvalidFieldValue with details in case deserialization fails.

v1.15

21 Nov 15:19
Compare
Choose a tag to compare

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:

@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.

v1.14

19 Nov 22:14
Compare
Choose a tag to compare

Features

  • Support Python 3.9

v1.13

18 Sep 10:39
Compare
Choose a tag to compare

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:

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"]]

v1.12

13 Dec 21:44
Compare
Choose a tag to compare

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:

@dataclass
class A:
    a: int

@dataclass
class B(A, DataClassDictMixin):
    pass

# ...
# KeyError: '__annotations__'

v1.11

12 Dec 21:56
Compare
Choose a tag to compare

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

v1.10

10 Dec 17:34
Compare
Choose a tag to compare

Features

  • Add support for classes implementing the os.PathLike interface

v1.9

04 Nov 21:06
Compare
Choose a tag to compare

Features

  • Add support for timezone class instances