]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
➕ Migrate internal reference documentation from `typing_extensions.Doc` to `annotated...
authorSebastián Ramírez <tiangolo@gmail.com>
Thu, 23 Oct 2025 20:31:35 +0000 (22:31 +0200)
committerGitHub <noreply@github.com>
Thu, 23 Oct 2025 20:31:35 +0000 (22:31 +0200)
14 files changed:
fastapi/applications.py
fastapi/background.py
fastapi/datastructures.py
fastapi/encoders.py
fastapi/exceptions.py
fastapi/openapi/docs.py
fastapi/param_functions.py
fastapi/routing.py
fastapi/security/api_key.py
fastapi/security/http.py
fastapi/security/oauth2.py
fastapi/security/open_id_connect_url.py
pyproject.toml
requirements-docs.txt

index 6db4b4e83d1c5a145ec7d007f256d770de4c8ecc..0a47699aefc982c46c2fe7c07c43cefb13ef2b01 100644 (file)
@@ -13,6 +13,7 @@ from typing import (
     Union,
 )
 
+from annotated_doc import Doc
 from fastapi import routing
 from fastapi.datastructures import Default, DefaultPlaceholder
 from fastapi.exception_handlers import (
@@ -43,7 +44,7 @@ from starlette.requests import Request
 from starlette.responses import HTMLResponse, JSONResponse, Response
 from starlette.routing import BaseRoute
 from starlette.types import ASGIApp, ExceptionHandler, Lifespan, Receive, Scope, Send
-from typing_extensions import Annotated, Doc, deprecated
+from typing_extensions import Annotated, deprecated
 
 AppType = TypeVar("AppType", bound="FastAPI")
 
index 203578a41f3cb594252e5a1700b48999270b5b27..6d4a30d4421e8074fcbae2a7981378b19e8687d3 100644 (file)
@@ -1,7 +1,8 @@
 from typing import Any, Callable
 
+from annotated_doc import Doc
 from starlette.background import BackgroundTasks as StarletteBackgroundTasks
-from typing_extensions import Annotated, Doc, ParamSpec
+from typing_extensions import Annotated, ParamSpec
 
 P = ParamSpec("P")
 
index 34185b96aa96116c81d6220003a9c50f38ea3c34..8ad9aa11a6fd8e8f16b62cd8b278e6f8184cef9f 100644 (file)
@@ -10,6 +10,7 @@ from typing import (
     cast,
 )
 
+from annotated_doc import Doc
 from fastapi._compat import (
     CoreSchema,
     GetJsonSchemaHandler,
@@ -22,7 +23,7 @@ from starlette.datastructures import Headers as Headers  # noqa: F401
 from starlette.datastructures import QueryParams as QueryParams  # noqa: F401
 from starlette.datastructures import State as State  # noqa: F401
 from starlette.datastructures import UploadFile as StarletteUploadFile
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 
 class UploadFile(StarletteUploadFile):
index bba9c970e0181f0614d001bcbd03e31c869eb753..6fc6228e157ac83ee003dd2f9ee6ef9e7c074244 100644 (file)
@@ -17,13 +17,14 @@ from types import GeneratorType
 from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
 from uuid import UUID
 
+from annotated_doc import Doc
 from fastapi._compat import may_v1
 from fastapi.types import IncEx
 from pydantic import BaseModel
 from pydantic.color import Color
 from pydantic.networks import AnyUrl, NameEmail
 from pydantic.types import SecretBytes, SecretStr
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 from ._compat import Url, _is_undefined, _model_dump
 
index 44d4ada86d7e453df892db115b4acd1c7a95e603..bb775fcbfa593960bb856259f2986cc8da7ae5d5 100644 (file)
@@ -1,9 +1,10 @@
 from typing import Any, Dict, Optional, Sequence, Type, Union
 
+from annotated_doc import Doc
 from pydantic import BaseModel, create_model
 from starlette.exceptions import HTTPException as StarletteHTTPException
 from starlette.exceptions import WebSocketException as StarletteWebSocketException
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 
 class HTTPException(StarletteHTTPException):
index f181b43c1b9301308f48c0cd1f8df802dee3f0d2..74b23a3706a4d42aeeddc103bfe42e0eb530d8da 100644 (file)
@@ -1,9 +1,10 @@
 import json
 from typing import Any, Dict, Optional
 
+from annotated_doc import Doc
 from fastapi.encoders import jsonable_encoder
 from starlette.responses import HTMLResponse
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 swagger_ui_default_parameters: Annotated[
     Dict[str, Any],
index b3621626cfd0264c3d82f9db02711bd17a23b994..f88937e240a8683aa905202614227ec1bf5abaef 100644 (file)
@@ -1,9 +1,10 @@
 from typing import Any, Callable, Dict, List, Optional, Sequence, Union
 
+from annotated_doc import Doc
 from fastapi import params
 from fastapi._compat import Undefined
 from fastapi.openapi.models import Example
-from typing_extensions import Annotated, Doc, deprecated
+from typing_extensions import Annotated, deprecated
 
 _Unset: Any = Undefined
 
index fe25d7dec773ec2f031a458f81f043b43ad3b207..0b59d250a4283dd7e1f7d5cd43790c03448d76f9 100644 (file)
@@ -24,6 +24,7 @@ from typing import (
     Union,
 )
 
+from annotated_doc import Doc
 from fastapi import params, temp_pydantic_v1_params
 from fastapi._compat import (
     ModelField,
@@ -76,7 +77,7 @@ from starlette.routing import (
 from starlette.routing import Mount as Mount  # noqa
 from starlette.types import AppType, ASGIApp, Lifespan, Receive, Scope, Send
 from starlette.websockets import WebSocket
-from typing_extensions import Annotated, Doc, deprecated
+from typing_extensions import Annotated, deprecated
 
 if sys.version_info >= (3, 13):  # pragma: no cover
     from inspect import iscoroutinefunction
index 6d6dd01d91ff854fe8cb0e5bbe2e6c050e41141d..496c815a77a295a2615bbd9ccc345f372cd85305 100644 (file)
@@ -1,11 +1,12 @@
 from typing import Optional
 
+from annotated_doc import Doc
 from fastapi.openapi.models import APIKey, APIKeyIn
 from fastapi.security.base import SecurityBase
 from starlette.exceptions import HTTPException
 from starlette.requests import Request
 from starlette.status import HTTP_403_FORBIDDEN
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 
 class APIKeyBase(SecurityBase):
index 9ab2df3c98e1e08a920de9439e78ecd65c2daada..3a5985650a068476eaa3d0e1579b144be7fa1708 100644 (file)
@@ -2,6 +2,7 @@ import binascii
 from base64 import b64decode
 from typing import Optional
 
+from annotated_doc import Doc
 from fastapi.exceptions import HTTPException
 from fastapi.openapi.models import HTTPBase as HTTPBaseModel
 from fastapi.openapi.models import HTTPBearer as HTTPBearerModel
@@ -10,7 +11,7 @@ from fastapi.security.utils import get_authorization_scheme_param
 from pydantic import BaseModel
 from starlette.requests import Request
 from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 
 class HTTPBasicCredentials(BaseModel):
index fdedbc2dad1b8b3ae348e951f28923286426b24b..f8d97d76206f6033b77c014fec0b55f36ad1bae4 100644 (file)
@@ -1,5 +1,6 @@
 from typing import Any, Dict, List, Optional, Union, cast
 
+from annotated_doc import Doc
 from fastapi.exceptions import HTTPException
 from fastapi.openapi.models import OAuth2 as OAuth2Model
 from fastapi.openapi.models import OAuthFlows as OAuthFlowsModel
@@ -10,7 +11,7 @@ from starlette.requests import Request
 from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
 
 # TODO: import from typing when deprecating Python 3.9
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 
 class OAuth2PasswordRequestForm:
index c8cceb911cf6690c2f5b1630718ef39c8f602ea0..5e99798e6329a2c073cdcf2efe068d3779d61e1e 100644 (file)
@@ -1,11 +1,12 @@
 from typing import Optional
 
+from annotated_doc import Doc
 from fastapi.openapi.models import OpenIdConnect as OpenIdConnectModel
 from fastapi.security.base import SecurityBase
 from starlette.exceptions import HTTPException
 from starlette.requests import Request
 from starlette.status import HTTP_403_FORBIDDEN
-from typing_extensions import Annotated, Doc
+from typing_extensions import Annotated
 
 
 class OpenIdConnect(SecurityBase):
index cac8059f47eefa517ea438a6145710c01d60d517..875e4bed12889f8291a16378bf5bda89aff2e094 100644 (file)
@@ -47,6 +47,7 @@ dependencies = [
     "starlette>=0.40.0,<0.49.0",
     "pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0",
     "typing-extensions>=4.8.0",
+    "annotated-doc>=0.0.2",
 ]
 
 [project.urls]
index 0013f9f79d855a1680a237298a58891d2afd323a..6baf19b50c345c480840c01dca97d685647caacf 100644 (file)
@@ -12,7 +12,7 @@ pillow==11.3.0
 # For image processing by Material for MkDocs
 cairosvg==2.8.2
 mkdocstrings[python]==0.26.1
-griffe-typingdoc==0.2.9
+griffe-typingdoc==0.3.0
 # For griffe, it formats with black
 black==25.1.0
 mkdocs-macros-plugin==1.4.0