Browse Source

Add better docstring

pull/11634/head
Alex Couper 1 year ago
parent
commit
78d1336cbb
  1. 104
      fastapi/applications.py
  2. 104
      fastapi/routing.py

104
fastapi/applications.py

@ -1716,7 +1716,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -2093,7 +2104,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -2475,7 +2497,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -2857,7 +2890,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -3234,7 +3278,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -3611,7 +3666,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -3988,7 +4054,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -4370,7 +4447,18 @@ class FastAPI(Starlette):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,

104
fastapi/routing.py

@ -1576,7 +1576,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
),
] = None,
include_in_schema: Annotated[
bool,
@ -1957,7 +1968,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -2343,7 +2365,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -2729,7 +2762,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -3110,7 +3154,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -3491,7 +3546,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -3877,7 +3943,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,
@ -4263,7 +4340,18 @@ class APIRouter(routing.Router):
),
] = False,
response_model_context: Annotated[
Optional[dict], Doc("Context to be used when encoding the response model.")
Optional[Dict[str, Any]], Doc(
"""
Additional context to pass to Pydantic when creating the response.
This will be passed in as serialization context to the response model.
Note: This feature is a noop on pydantic < 2.7.2
Read more about serialization context in the
[Pydantic documentation](https://docs.pydantic.dev/latest/concepts/serialization/#serialization-context)
"""
)
] = None,
include_in_schema: Annotated[
bool,

Loading…
Cancel
Save