<!-- Release notes generated using configuration in .github/release.yml at main -->
What's Changed
New features
* Union directly by yukinarit in https://github.com/yukinarit/pyserde/pull/339
This example works correctly now
python
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
python
print(to_json(bar))
For more information about Union, please see [the docs](https://github.com/yukinarit/pyserde/blob/main/docs/en/union.md#deserializing-union-types-directly)
Refactoring
* Fix mypy/pyright errors in serde/inspect.py by yukinarit in https://github.com/yukinarit/pyserde/pull/401
* Fix mypy/pyright errors in serde/__init__.py by yukinarit in https://github.com/yukinarit/pyserde/pull/402
* Fix mypy/pyright errors in serde/compat.py by yukinarit in https://github.com/yukinarit/pyserde/pull/403
Other changes
* Change line length from 120 to 100 by yukinarit in https://github.com/yukinarit/pyserde/pull/391
**Full Changelog**: https://github.com/yukinarit/pyserde/compare/v0.11.1...v0.12.0