added Python 3.10+ syntax for small part

This commit is contained in:
Dauletkhan Assanov 2024-05-05 18:36:52 +05:00
parent 8c572a9ef2
commit b57f2a43d9
1 changed files with 14 additions and 2 deletions

View File

@ -385,13 +385,25 @@ q: Union[str, None] = None
But we are now declaring it with `Query`, for example like:
=== "Annotated"
=== "Python 3.10+ Annotated"
```Python
q: Annotated[str | None, Query(min_length=3)] = None
```
=== "Python 3.9+ Annotated"
```Python
q: Annotated[Union[str, None], Query(min_length=3)] = None
```
=== "non-Annotated"
=== "Python 3.10+ non-Annotated"
```Python
q: str | None = Query(default=None, min_length=3)
```
=== "Python 3.9+ non-Annotated"
```Python
q: Union[str, None] = Query(default=None, min_length=3)