Skip to content

Commit

Permalink
📝 Add notification message warning about old versions of FastAPI not …
Browse files Browse the repository at this point in the history
…supporting `Annotated` (#9298)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
  • Loading branch information
grdworkin and tiangolo committed Apr 13, 2023
1 parent 925ba5c commit 8df8630
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/en/docs/tutorial/dependencies/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ In this case, this dependency expects:

And then it just returns a `dict` containing those values.

!!! info
FastAPI added support for `Annotated` (and started recommending it) in version 0.95.0.

If you have an older version, you would get errors when trying to use `Annotated`.

Make sure you [Upgrade the FastAPI version](../../deployment/versions.md#upgrading-the-fastapi-versions){.internal-link target=_blank} to at least 0.95.1 before using `Annotated`.

### Import `Depends`

=== "Python 3.10+"
Expand Down
7 changes: 7 additions & 0 deletions docs/en/docs/tutorial/path-params-numeric-validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ First, import `Path` from `fastapi`, and import `Annotated`:
{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
```

!!! info
FastAPI added support for `Annotated` (and started recommending it) in version 0.95.0.

If you have an older version, you would get errors when trying to use `Annotated`.

Make sure you [Upgrade the FastAPI version](../deployment/versions.md#upgrading-the-fastapi-versions){.internal-link target=_blank} to at least 0.95.1 before using `Annotated`.

## Declare metadata

You can declare all the same parameters as for `Query`.
Expand Down
7 changes: 7 additions & 0 deletions docs/en/docs/tutorial/query-params-str-validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ To achieve that, first import:
{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
```

!!! info
FastAPI added support for `Annotated` (and started recommending it) in version 0.95.0.

If you have an older version, you would get errors when trying to use `Annotated`.

Make sure you [Upgrade the FastAPI version](../deployment/versions.md#upgrading-the-fastapi-versions){.internal-link target=_blank} to at least 0.95.1 before using `Annotated`.

## Use `Annotated` in the type for the `q` parameter

Remember I told you before that `Annotated` can be used to add metadata to your parameters in the [Python Types Intro](../python-types.md#type-hints-with-metadata-annotations){.internal-link target=_blank}?
Expand Down

0 comments on commit 8df8630

Please sign in to comment.