From: Geoff Dworkin <128619245+grdworkin@users.noreply.github.com> Date: Thu, 13 Apr 2023 18:57:59 +0000 (-0500) Subject: 📝 Add notification message warning about old versions of FastAPI not supporting ... X-Git-Tag: 0.95.1~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8df86309c8a09eda02e3ab760ee8d98c83f3f2b9;p=thirdparty%2Ffastapi%2Ffastapi.git 📝 Add notification message warning about old versions of FastAPI not supporting `Annotated` (#9298) Co-authored-by: Sebastián Ramírez --- diff --git a/docs/en/docs/tutorial/dependencies/index.md b/docs/en/docs/tutorial/dependencies/index.md index 80087a4a77..4f5ecea666 100644 --- a/docs/en/docs/tutorial/dependencies/index.md +++ b/docs/en/docs/tutorial/dependencies/index.md @@ -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+" diff --git a/docs/en/docs/tutorial/path-params-numeric-validations.md b/docs/en/docs/tutorial/path-params-numeric-validations.md index 433e3c1340..9255875d60 100644 --- a/docs/en/docs/tutorial/path-params-numeric-validations.md +++ b/docs/en/docs/tutorial/path-params-numeric-validations.md @@ -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`. diff --git a/docs/en/docs/tutorial/query-params-str-validations.md b/docs/en/docs/tutorial/query-params-str-validations.md index 8a801cda27..c4b221cb15 100644 --- a/docs/en/docs/tutorial/query-params-str-validations.md +++ b/docs/en/docs/tutorial/query-params-str-validations.md @@ -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}?