You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d142672
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: HISTORY.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,8 @@ Our backwards-compatibility policy can be found [here](https://github.com/python
- The [union passthrough strategy](https://catt.rs/en/stable/strategies.html#union-passthrough) now supports PEP 695 type aliases as union members.
Copy file name to clipboardExpand all lines: docs/defaulthooks.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -640,6 +640,10 @@ Their hooks can also be overriden using [](customizing.md#predicate-hooks).
640
640
Type aliases using [`typing.TypeAlias`](https://docs.python.org/3/library/typing.html#typing.TypeAlias) aren't supported since there is no way at runtime to distinguish them from their underlying types.
641
641
```
642
642
643
+
```{versionchanged} 26.2.0
644
+
The [union passthrough strategy](strategies.md#union-passthrough) also recognizes type aliases used as union members.
Copy file name to clipboardExpand all lines: docs/strategies.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -367,6 +367,10 @@ The strategy also supports [NewTypes](https://mypy.readthedocs.io/en/stable/more
367
367
12
368
368
```
369
369
370
+
```{versionchanged} 26.2.0
371
+
PEP 695 type aliases of supported types are supported when used as union members.
372
+
```
373
+
370
374
Unions containing unsupported types can be handled if at least one union type is supported by the strategy; the supported union types will be checked before the rest (referred to as the _spillover_) is handed over to the converter again.
371
375
372
376
For example, if `A` and `B` are arbitrary _attrs_ classes, the union `Literal[10] | A | B` cannot be handled directly by a JSON converter.
0 commit comments