mirror of https://github.com/tiangolo/fastapi.git
Merge aef56cdf2e into 31bbb38074
This commit is contained in:
commit
5f2c524f2c
|
|
@ -509,6 +509,14 @@ class FastAPI(Starlette):
|
|||
Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
|
||||
"""
|
||||
),
|
||||
deprecated(
|
||||
"""
|
||||
**Attention**: This parameter is deprecated.
|
||||
|
||||
The recommended approach for managing startup and shutdown
|
||||
is by utilizing the lifespan parameter within the FastAPI app.
|
||||
"""
|
||||
),
|
||||
] = None,
|
||||
on_shutdown: Annotated[
|
||||
Sequence[Callable[[], Any]] | None,
|
||||
|
|
@ -522,6 +530,14 @@ class FastAPI(Starlette):
|
|||
[FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
|
||||
"""
|
||||
),
|
||||
deprecated(
|
||||
"""
|
||||
**Attention**: This parameter is deprecated.
|
||||
|
||||
The recommended approach for managing startup and shutdown
|
||||
is by utilizing the lifespan parameter within the FastAPI app.
|
||||
"""
|
||||
),
|
||||
] = None,
|
||||
lifespan: Annotated[
|
||||
Lifespan[AppType] | None,
|
||||
|
|
|
|||
|
|
@ -1173,6 +1173,14 @@ class APIRouter(routing.Router):
|
|||
Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
|
||||
"""
|
||||
),
|
||||
deprecated(
|
||||
"""
|
||||
**Attention**: This parameter is deprecated.
|
||||
|
||||
The recommended approach for managing startup and shutdown
|
||||
is by utilizing the lifespan parameter within the APIRouter.
|
||||
"""
|
||||
),
|
||||
] = None,
|
||||
on_shutdown: Annotated[
|
||||
Sequence[Callable[[], Any]] | None,
|
||||
|
|
@ -1186,6 +1194,14 @@ class APIRouter(routing.Router):
|
|||
[FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
|
||||
"""
|
||||
),
|
||||
deprecated(
|
||||
"""
|
||||
**Attention**: This parameter is deprecated.
|
||||
|
||||
The recommended approach for managing startup and shutdown
|
||||
is by utilizing the lifespan parameter within the APIRouter.
|
||||
"""
|
||||
),
|
||||
] = None,
|
||||
# the generic to Lifespan[AppType] is the type of the top level application
|
||||
# which the router cannot know statically, so we use typing.Any
|
||||
|
|
|
|||
Loading…
Reference in New Issue