File: subclass_union.md

package info (click to toggle)
python-apischema 0.18.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,636 kB
  • sloc: python: 15,281; makefile: 3; sh: 2
file content (9 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
# Class as union of its subclasses 

*Inspired by [https://github.com/samuelcolvin/pydantic/issues/2036](https://github.com/samuelcolvin/pydantic/issues/2036)*

A class can easily be deserialized as a union of its subclasses using deserializers. Indeed, when more than one deserializer is registered, it results in a union.

```python
{!examples/subclass_union.py!}
```