Skip to content

v2.9.1

Compare
Choose a tag to compare
@Fatal1ty Fatal1ty released this 18 Dec 14:37
· 732 commits to master since this release

Changes

  • Fixed installing with third-party tool pdistx. See #60.
  • Fixed serialzation / deserialization override for Union and TypeVar types. See #61.
  • Fixed the default value of by_alias argument of to_dict method when using serialize_by_alias config option. In the previous versions by_alias argument had a default valueFalse regardless of whether serialize_by_alias config options was used. Now it could be True:
@dataclass
class MyClass(DataClassDictMixin):
    x: int

    class Config(BaseConfig):
        aliases = {"x": "x_alias"}
        serialize_by_alias = True
        code_generation_options = [TO_DICT_ADD_BY_ALIAS_FLAG]

print(MyClass(x=1).to_dict())  # {'x_alias': 1}
print(MyClass(x=1).to_dict(by_alias=False))  # {x': 1}