Skip to content

v0.12.0

Compare
Choose a tag to compare
@yukinarit yukinarit released this 15 Jul 08:21
· 274 commits to main since this release
7bb6c0f

What's Changed

New features

This example works correctly now

@serde
@dataclass
class Foo:
    a: int

@serde
@dataclass
class Bar:
    a: int

bar = Bar(10)
s = to_json(bar)
print(s)
print(from_json(Union[Foo, Bar], s))

However, This will introduce a breaking change!! The default behaviour when you pass Union directly was "Untagged" until v0.11.1, but since v0.12.0 it is "ExternalTagging".

The following code prints {"a": 10} until v0.11.1, but prints {"Bar": {"a": 10}} since v0.12.0

print(to_json(bar))

For more information about Union, please see the docs

Refactoring

Other changes

Full Changelog: v0.11.1...v0.12.0