fastapi 0.115.11__py3-none-any.whl → 0.115.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fastapi might be problematic. Click here for more details.
- fastapi/__init__.py +1 -1
- fastapi/_compat.py +5 -0
- fastapi/applications.py +15 -12
- fastapi/dependencies/utils.py +30 -22
- fastapi/openapi/docs.py +1 -1
- fastapi/openapi/utils.py +28 -7
- fastapi/routing.py +21 -21
- fastapi/security/oauth2.py +18 -3
- {fastapi-0.115.11.dist-info → fastapi-0.115.13.dist-info}/METADATA +6 -8
- {fastapi-0.115.11.dist-info → fastapi-0.115.13.dist-info}/RECORD +13 -13
- {fastapi-0.115.11.dist-info → fastapi-0.115.13.dist-info}/WHEEL +1 -1
- {fastapi-0.115.11.dist-info → fastapi-0.115.13.dist-info}/entry_points.txt +0 -0
- {fastapi-0.115.11.dist-info → fastapi-0.115.13.dist-info}/licenses/LICENSE +0 -0
fastapi/__init__.py
CHANGED
fastapi/_compat.py
CHANGED
|
@@ -16,6 +16,7 @@ from typing import (
|
|
|
16
16
|
Tuple,
|
|
17
17
|
Type,
|
|
18
18
|
Union,
|
|
19
|
+
cast,
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
from fastapi.exceptions import RequestErrorModel
|
|
@@ -231,6 +232,10 @@ if PYDANTIC_V2:
|
|
|
231
232
|
field_mapping, definitions = schema_generator.generate_definitions(
|
|
232
233
|
inputs=inputs
|
|
233
234
|
)
|
|
235
|
+
for item_def in cast(Dict[str, Dict[str, Any]], definitions).values():
|
|
236
|
+
if "description" in item_def:
|
|
237
|
+
item_description = cast(str, item_def["description"]).split("\f")[0]
|
|
238
|
+
item_def["description"] = item_description
|
|
234
239
|
return field_mapping, definitions # type: ignore[return-value]
|
|
235
240
|
|
|
236
241
|
def is_scalar_field(field: ModelField) -> bool:
|
fastapi/applications.py
CHANGED
|
@@ -748,7 +748,7 @@ class FastAPI(Starlette):
|
|
|
748
748
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
749
749
|
|
|
750
750
|
Read more about it in the
|
|
751
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
751
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
752
752
|
"""
|
|
753
753
|
),
|
|
754
754
|
] = True,
|
|
@@ -1720,7 +1720,7 @@ class FastAPI(Starlette):
|
|
|
1720
1720
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
1721
1721
|
|
|
1722
1722
|
Read more about it in the
|
|
1723
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
1723
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
1724
1724
|
"""
|
|
1725
1725
|
),
|
|
1726
1726
|
] = True,
|
|
@@ -2093,7 +2093,7 @@ class FastAPI(Starlette):
|
|
|
2093
2093
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
2094
2094
|
|
|
2095
2095
|
Read more about it in the
|
|
2096
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
2096
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
2097
2097
|
"""
|
|
2098
2098
|
),
|
|
2099
2099
|
] = True,
|
|
@@ -2471,7 +2471,7 @@ class FastAPI(Starlette):
|
|
|
2471
2471
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
2472
2472
|
|
|
2473
2473
|
Read more about it in the
|
|
2474
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
2474
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
2475
2475
|
"""
|
|
2476
2476
|
),
|
|
2477
2477
|
] = True,
|
|
@@ -2849,7 +2849,7 @@ class FastAPI(Starlette):
|
|
|
2849
2849
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
2850
2850
|
|
|
2851
2851
|
Read more about it in the
|
|
2852
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
2852
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
2853
2853
|
"""
|
|
2854
2854
|
),
|
|
2855
2855
|
] = True,
|
|
@@ -3222,7 +3222,7 @@ class FastAPI(Starlette):
|
|
|
3222
3222
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
3223
3223
|
|
|
3224
3224
|
Read more about it in the
|
|
3225
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
3225
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
3226
3226
|
"""
|
|
3227
3227
|
),
|
|
3228
3228
|
] = True,
|
|
@@ -3595,7 +3595,7 @@ class FastAPI(Starlette):
|
|
|
3595
3595
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
3596
3596
|
|
|
3597
3597
|
Read more about it in the
|
|
3598
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
3598
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
3599
3599
|
"""
|
|
3600
3600
|
),
|
|
3601
3601
|
] = True,
|
|
@@ -3968,7 +3968,7 @@ class FastAPI(Starlette):
|
|
|
3968
3968
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
3969
3969
|
|
|
3970
3970
|
Read more about it in the
|
|
3971
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
3971
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
3972
3972
|
"""
|
|
3973
3973
|
),
|
|
3974
3974
|
] = True,
|
|
@@ -4346,7 +4346,7 @@ class FastAPI(Starlette):
|
|
|
4346
4346
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
4347
4347
|
|
|
4348
4348
|
Read more about it in the
|
|
4349
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
4349
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
4350
4350
|
"""
|
|
4351
4351
|
),
|
|
4352
4352
|
] = True,
|
|
@@ -4425,7 +4425,7 @@ class FastAPI(Starlette):
|
|
|
4425
4425
|
|
|
4426
4426
|
app = FastAPI()
|
|
4427
4427
|
|
|
4428
|
-
@app.
|
|
4428
|
+
@app.trace("/items/{item_id}")
|
|
4429
4429
|
def trace_item(item_id: str):
|
|
4430
4430
|
return None
|
|
4431
4431
|
```
|
|
@@ -4515,14 +4515,17 @@ class FastAPI(Starlette):
|
|
|
4515
4515
|
|
|
4516
4516
|
```python
|
|
4517
4517
|
import time
|
|
4518
|
+
from typing import Awaitable, Callable
|
|
4518
4519
|
|
|
4519
|
-
from fastapi import FastAPI, Request
|
|
4520
|
+
from fastapi import FastAPI, Request, Response
|
|
4520
4521
|
|
|
4521
4522
|
app = FastAPI()
|
|
4522
4523
|
|
|
4523
4524
|
|
|
4524
4525
|
@app.middleware("http")
|
|
4525
|
-
async def add_process_time_header(
|
|
4526
|
+
async def add_process_time_header(
|
|
4527
|
+
request: Request, call_next: Callable[[Request], Awaitable[Response]]
|
|
4528
|
+
) -> Response:
|
|
4526
4529
|
start_time = time.time()
|
|
4527
4530
|
response = await call_next(request)
|
|
4528
4531
|
process_time = time.time() - start_time
|
fastapi/dependencies/utils.py
CHANGED
|
@@ -133,9 +133,9 @@ def get_param_sub_dependant(
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
def get_parameterless_sub_dependant(*, depends: params.Depends, path: str) -> Dependant:
|
|
136
|
-
assert callable(
|
|
137
|
-
|
|
138
|
-
)
|
|
136
|
+
assert callable(depends.dependency), (
|
|
137
|
+
"A parameter-less dependency must have a callable dependency"
|
|
138
|
+
)
|
|
139
139
|
return get_sub_dependant(depends=depends, dependency=depends.dependency, path=path)
|
|
140
140
|
|
|
141
141
|
|
|
@@ -302,9 +302,9 @@ def get_dependant(
|
|
|
302
302
|
type_annotation=param_details.type_annotation,
|
|
303
303
|
dependant=dependant,
|
|
304
304
|
):
|
|
305
|
-
assert (
|
|
306
|
-
|
|
307
|
-
)
|
|
305
|
+
assert param_details.field is None, (
|
|
306
|
+
f"Cannot specify multiple FastAPI annotations for {param_name!r}"
|
|
307
|
+
)
|
|
308
308
|
continue
|
|
309
309
|
assert param_details.field is not None
|
|
310
310
|
if isinstance(param_details.field.field_info, params.Body):
|
|
@@ -439,9 +439,9 @@ def analyze_param(
|
|
|
439
439
|
),
|
|
440
440
|
):
|
|
441
441
|
assert depends is None, f"Cannot specify `Depends` for type {type_annotation!r}"
|
|
442
|
-
assert (
|
|
443
|
-
|
|
444
|
-
)
|
|
442
|
+
assert field_info is None, (
|
|
443
|
+
f"Cannot specify FastAPI annotation for type {type_annotation!r}"
|
|
444
|
+
)
|
|
445
445
|
# Handle default assignations, neither field_info nor depends was not found in Annotated nor default value
|
|
446
446
|
elif field_info is None and depends is None:
|
|
447
447
|
default_value = value if value is not inspect.Signature.empty else RequiredParam
|
|
@@ -494,9 +494,9 @@ def analyze_param(
|
|
|
494
494
|
field_info=field_info,
|
|
495
495
|
)
|
|
496
496
|
if is_path_param:
|
|
497
|
-
assert is_scalar_field(
|
|
498
|
-
|
|
499
|
-
)
|
|
497
|
+
assert is_scalar_field(field=field), (
|
|
498
|
+
"Path params must be of one of the supported types"
|
|
499
|
+
)
|
|
500
500
|
elif isinstance(field_info, params.Query):
|
|
501
501
|
assert (
|
|
502
502
|
is_scalar_field(field)
|
|
@@ -521,9 +521,9 @@ def add_param_to_fields(*, field: ModelField, dependant: Dependant) -> None:
|
|
|
521
521
|
elif field_info_in == params.ParamTypes.header:
|
|
522
522
|
dependant.header_params.append(field)
|
|
523
523
|
else:
|
|
524
|
-
assert (
|
|
525
|
-
|
|
526
|
-
)
|
|
524
|
+
assert field_info_in == params.ParamTypes.cookie, (
|
|
525
|
+
f"non-body parameters must be in path, query, header or cookie: {field.name}"
|
|
526
|
+
)
|
|
527
527
|
dependant.cookie_params.append(field)
|
|
528
528
|
|
|
529
529
|
|
|
@@ -750,9 +750,15 @@ def request_params_to_args(
|
|
|
750
750
|
first_field = fields[0]
|
|
751
751
|
fields_to_extract = fields
|
|
752
752
|
single_not_embedded_field = False
|
|
753
|
+
default_convert_underscores = True
|
|
753
754
|
if len(fields) == 1 and lenient_issubclass(first_field.type_, BaseModel):
|
|
754
755
|
fields_to_extract = get_cached_model_fields(first_field.type_)
|
|
755
756
|
single_not_embedded_field = True
|
|
757
|
+
# If headers are in a Pydantic model, the way to disable convert_underscores
|
|
758
|
+
# would be with Header(convert_underscores=False) at the Pydantic model level
|
|
759
|
+
default_convert_underscores = getattr(
|
|
760
|
+
first_field.field_info, "convert_underscores", True
|
|
761
|
+
)
|
|
756
762
|
|
|
757
763
|
params_to_process: Dict[str, Any] = {}
|
|
758
764
|
|
|
@@ -763,7 +769,9 @@ def request_params_to_args(
|
|
|
763
769
|
if isinstance(received_params, Headers):
|
|
764
770
|
# Handle fields extracted from a Pydantic Model for a header, each field
|
|
765
771
|
# doesn't have a FieldInfo of type Header with the default convert_underscores=True
|
|
766
|
-
convert_underscores = getattr(
|
|
772
|
+
convert_underscores = getattr(
|
|
773
|
+
field.field_info, "convert_underscores", default_convert_underscores
|
|
774
|
+
)
|
|
767
775
|
if convert_underscores:
|
|
768
776
|
alias = (
|
|
769
777
|
field.alias
|
|
@@ -782,9 +790,9 @@ def request_params_to_args(
|
|
|
782
790
|
|
|
783
791
|
if single_not_embedded_field:
|
|
784
792
|
field_info = first_field.field_info
|
|
785
|
-
assert isinstance(
|
|
786
|
-
|
|
787
|
-
)
|
|
793
|
+
assert isinstance(field_info, params.Param), (
|
|
794
|
+
"Params must be subclasses of Param"
|
|
795
|
+
)
|
|
788
796
|
loc: Tuple[str, ...] = (field_info.in_.value,)
|
|
789
797
|
v_, errors_ = _validate_value_with_model_field(
|
|
790
798
|
field=first_field, value=params_to_process, values=values, loc=loc
|
|
@@ -794,9 +802,9 @@ def request_params_to_args(
|
|
|
794
802
|
for field in fields:
|
|
795
803
|
value = _get_multidict_value(field, received_params)
|
|
796
804
|
field_info = field.field_info
|
|
797
|
-
assert isinstance(
|
|
798
|
-
|
|
799
|
-
)
|
|
805
|
+
assert isinstance(field_info, params.Param), (
|
|
806
|
+
"Params must be subclasses of Param"
|
|
807
|
+
)
|
|
800
808
|
loc = (field_info.in_.value, field.alias)
|
|
801
809
|
v_, errors_ = _validate_value_with_model_field(
|
|
802
810
|
field=field, value=value, values=values, loc=loc
|
fastapi/openapi/docs.py
CHANGED
|
@@ -188,7 +188,7 @@ def get_redoc_html(
|
|
|
188
188
|
It is normally set to a CDN URL.
|
|
189
189
|
"""
|
|
190
190
|
),
|
|
191
|
-
] = "https://cdn.jsdelivr.net/npm/redoc@
|
|
191
|
+
] = "https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js",
|
|
192
192
|
redoc_favicon_url: Annotated[
|
|
193
193
|
str,
|
|
194
194
|
Doc(
|
fastapi/openapi/utils.py
CHANGED
|
@@ -32,6 +32,7 @@ from fastapi.utils import (
|
|
|
32
32
|
generate_operation_id_for_path,
|
|
33
33
|
is_body_allowed_for_status_code,
|
|
34
34
|
)
|
|
35
|
+
from pydantic import BaseModel
|
|
35
36
|
from starlette.responses import JSONResponse
|
|
36
37
|
from starlette.routing import BaseRoute
|
|
37
38
|
from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY
|
|
@@ -113,6 +114,13 @@ def _get_openapi_operation_parameters(
|
|
|
113
114
|
(ParamTypes.header, header_params),
|
|
114
115
|
(ParamTypes.cookie, cookie_params),
|
|
115
116
|
]
|
|
117
|
+
default_convert_underscores = True
|
|
118
|
+
if len(flat_dependant.header_params) == 1:
|
|
119
|
+
first_field = flat_dependant.header_params[0]
|
|
120
|
+
if lenient_issubclass(first_field.type_, BaseModel):
|
|
121
|
+
default_convert_underscores = getattr(
|
|
122
|
+
first_field.field_info, "convert_underscores", True
|
|
123
|
+
)
|
|
116
124
|
for param_type, param_group in parameter_groups:
|
|
117
125
|
for param in param_group:
|
|
118
126
|
field_info = param.field_info
|
|
@@ -126,8 +134,21 @@ def _get_openapi_operation_parameters(
|
|
|
126
134
|
field_mapping=field_mapping,
|
|
127
135
|
separate_input_output_schemas=separate_input_output_schemas,
|
|
128
136
|
)
|
|
137
|
+
name = param.alias
|
|
138
|
+
convert_underscores = getattr(
|
|
139
|
+
param.field_info,
|
|
140
|
+
"convert_underscores",
|
|
141
|
+
default_convert_underscores,
|
|
142
|
+
)
|
|
143
|
+
if (
|
|
144
|
+
param_type == ParamTypes.header
|
|
145
|
+
and param.alias == param.name
|
|
146
|
+
and convert_underscores
|
|
147
|
+
):
|
|
148
|
+
name = param.name.replace("_", "-")
|
|
149
|
+
|
|
129
150
|
parameter = {
|
|
130
|
-
"name":
|
|
151
|
+
"name": name,
|
|
131
152
|
"in": param_type.value,
|
|
132
153
|
"required": param.required,
|
|
133
154
|
"schema": param_schema,
|
|
@@ -364,9 +385,9 @@ def get_openapi_path(
|
|
|
364
385
|
openapi_response = operation_responses.setdefault(
|
|
365
386
|
status_code_key, {}
|
|
366
387
|
)
|
|
367
|
-
assert isinstance(
|
|
368
|
-
|
|
369
|
-
)
|
|
388
|
+
assert isinstance(process_response, dict), (
|
|
389
|
+
"An additional response must be a dict"
|
|
390
|
+
)
|
|
370
391
|
field = route.response_fields.get(additional_status_code)
|
|
371
392
|
additional_field_schema: Optional[Dict[str, Any]] = None
|
|
372
393
|
if field:
|
|
@@ -434,9 +455,9 @@ def get_fields_from_routes(
|
|
|
434
455
|
route, routing.APIRoute
|
|
435
456
|
):
|
|
436
457
|
if route.body_field:
|
|
437
|
-
assert isinstance(
|
|
438
|
-
|
|
439
|
-
)
|
|
458
|
+
assert isinstance(route.body_field, ModelField), (
|
|
459
|
+
"A request body must be a Pydantic Field"
|
|
460
|
+
)
|
|
440
461
|
body_fields_from_routes.append(route.body_field)
|
|
441
462
|
if route.response_field:
|
|
442
463
|
responses_from_routes.append(route.response_field)
|
fastapi/routing.py
CHANGED
|
@@ -504,9 +504,9 @@ class APIRoute(routing.Route):
|
|
|
504
504
|
status_code = int(status_code)
|
|
505
505
|
self.status_code = status_code
|
|
506
506
|
if self.response_model:
|
|
507
|
-
assert is_body_allowed_for_status_code(
|
|
508
|
-
status_code
|
|
509
|
-
)
|
|
507
|
+
assert is_body_allowed_for_status_code(status_code), (
|
|
508
|
+
f"Status code {status_code} must not have a response body"
|
|
509
|
+
)
|
|
510
510
|
response_name = "Response_" + self.unique_id
|
|
511
511
|
self.response_field = create_model_field(
|
|
512
512
|
name=response_name,
|
|
@@ -537,9 +537,9 @@ class APIRoute(routing.Route):
|
|
|
537
537
|
assert isinstance(response, dict), "An additional response must be a dict"
|
|
538
538
|
model = response.get("model")
|
|
539
539
|
if model:
|
|
540
|
-
assert is_body_allowed_for_status_code(
|
|
541
|
-
additional_status_code
|
|
542
|
-
)
|
|
540
|
+
assert is_body_allowed_for_status_code(additional_status_code), (
|
|
541
|
+
f"Status code {additional_status_code} must not have a response body"
|
|
542
|
+
)
|
|
543
543
|
response_name = f"Response_{additional_status_code}_{self.unique_id}"
|
|
544
544
|
response_field = create_model_field(
|
|
545
545
|
name=response_name, type_=model, mode="serialization"
|
|
@@ -814,7 +814,7 @@ class APIRouter(routing.Router):
|
|
|
814
814
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
815
815
|
|
|
816
816
|
Read more about it in the
|
|
817
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
817
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
818
818
|
"""
|
|
819
819
|
),
|
|
820
820
|
] = True,
|
|
@@ -844,9 +844,9 @@ class APIRouter(routing.Router):
|
|
|
844
844
|
)
|
|
845
845
|
if prefix:
|
|
846
846
|
assert prefix.startswith("/"), "A path prefix must start with '/'"
|
|
847
|
-
assert not prefix.endswith(
|
|
848
|
-
"/"
|
|
849
|
-
)
|
|
847
|
+
assert not prefix.endswith("/"), (
|
|
848
|
+
"A path prefix must not end with '/', as the routes will start with '/'"
|
|
849
|
+
)
|
|
850
850
|
self.prefix = prefix
|
|
851
851
|
self.tags: List[Union[str, Enum]] = tags or []
|
|
852
852
|
self.dependencies = list(dependencies or [])
|
|
@@ -1256,9 +1256,9 @@ class APIRouter(routing.Router):
|
|
|
1256
1256
|
"""
|
|
1257
1257
|
if prefix:
|
|
1258
1258
|
assert prefix.startswith("/"), "A path prefix must start with '/'"
|
|
1259
|
-
assert not prefix.endswith(
|
|
1260
|
-
"/"
|
|
1261
|
-
)
|
|
1259
|
+
assert not prefix.endswith("/"), (
|
|
1260
|
+
"A path prefix must not end with '/', as the routes will start with '/'"
|
|
1261
|
+
)
|
|
1262
1262
|
else:
|
|
1263
1263
|
for r in router.routes:
|
|
1264
1264
|
path = getattr(r, "path") # noqa: B009
|
|
@@ -1626,7 +1626,7 @@ class APIRouter(routing.Router):
|
|
|
1626
1626
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
1627
1627
|
|
|
1628
1628
|
Read more about it in the
|
|
1629
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
1629
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
1630
1630
|
"""
|
|
1631
1631
|
),
|
|
1632
1632
|
] = True,
|
|
@@ -2003,7 +2003,7 @@ class APIRouter(routing.Router):
|
|
|
2003
2003
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
2004
2004
|
|
|
2005
2005
|
Read more about it in the
|
|
2006
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
2006
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
2007
2007
|
"""
|
|
2008
2008
|
),
|
|
2009
2009
|
] = True,
|
|
@@ -2385,7 +2385,7 @@ class APIRouter(routing.Router):
|
|
|
2385
2385
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
2386
2386
|
|
|
2387
2387
|
Read more about it in the
|
|
2388
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
2388
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
2389
2389
|
"""
|
|
2390
2390
|
),
|
|
2391
2391
|
] = True,
|
|
@@ -2767,7 +2767,7 @@ class APIRouter(routing.Router):
|
|
|
2767
2767
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
2768
2768
|
|
|
2769
2769
|
Read more about it in the
|
|
2770
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
2770
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
2771
2771
|
"""
|
|
2772
2772
|
),
|
|
2773
2773
|
] = True,
|
|
@@ -3144,7 +3144,7 @@ class APIRouter(routing.Router):
|
|
|
3144
3144
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
3145
3145
|
|
|
3146
3146
|
Read more about it in the
|
|
3147
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
3147
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
3148
3148
|
"""
|
|
3149
3149
|
),
|
|
3150
3150
|
] = True,
|
|
@@ -3521,7 +3521,7 @@ class APIRouter(routing.Router):
|
|
|
3521
3521
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
3522
3522
|
|
|
3523
3523
|
Read more about it in the
|
|
3524
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
3524
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
3525
3525
|
"""
|
|
3526
3526
|
),
|
|
3527
3527
|
] = True,
|
|
@@ -3903,7 +3903,7 @@ class APIRouter(routing.Router):
|
|
|
3903
3903
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
3904
3904
|
|
|
3905
3905
|
Read more about it in the
|
|
3906
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
3906
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
3907
3907
|
"""
|
|
3908
3908
|
),
|
|
3909
3909
|
] = True,
|
|
@@ -4285,7 +4285,7 @@ class APIRouter(routing.Router):
|
|
|
4285
4285
|
This affects the generated OpenAPI (e.g. visible at `/docs`).
|
|
4286
4286
|
|
|
4287
4287
|
Read more about it in the
|
|
4288
|
-
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
|
|
4288
|
+
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
|
|
4289
4289
|
"""
|
|
4290
4290
|
),
|
|
4291
4291
|
] = True,
|
fastapi/security/oauth2.py
CHANGED
|
@@ -85,7 +85,7 @@ class OAuth2PasswordRequestForm:
|
|
|
85
85
|
],
|
|
86
86
|
password: Annotated[
|
|
87
87
|
str,
|
|
88
|
-
Form(),
|
|
88
|
+
Form(json_schema_extra={"format": "password"}),
|
|
89
89
|
Doc(
|
|
90
90
|
"""
|
|
91
91
|
`password` string. The OAuth2 spec requires the exact field name
|
|
@@ -130,7 +130,7 @@ class OAuth2PasswordRequestForm:
|
|
|
130
130
|
] = None,
|
|
131
131
|
client_secret: Annotated[
|
|
132
132
|
Union[str, None],
|
|
133
|
-
Form(),
|
|
133
|
+
Form(json_schema_extra={"format": "password"}),
|
|
134
134
|
Doc(
|
|
135
135
|
"""
|
|
136
136
|
If there's a `client_password` (and a `client_id`), they can be sent
|
|
@@ -457,11 +457,26 @@ class OAuth2PasswordBearer(OAuth2):
|
|
|
457
457
|
"""
|
|
458
458
|
),
|
|
459
459
|
] = True,
|
|
460
|
+
refreshUrl: Annotated[
|
|
461
|
+
Optional[str],
|
|
462
|
+
Doc(
|
|
463
|
+
"""
|
|
464
|
+
The URL to refresh the token and obtain a new one.
|
|
465
|
+
"""
|
|
466
|
+
),
|
|
467
|
+
] = None,
|
|
460
468
|
):
|
|
461
469
|
if not scopes:
|
|
462
470
|
scopes = {}
|
|
463
471
|
flows = OAuthFlowsModel(
|
|
464
|
-
password=cast(
|
|
472
|
+
password=cast(
|
|
473
|
+
Any,
|
|
474
|
+
{
|
|
475
|
+
"tokenUrl": tokenUrl,
|
|
476
|
+
"refreshUrl": refreshUrl,
|
|
477
|
+
"scopes": scopes,
|
|
478
|
+
},
|
|
479
|
+
)
|
|
465
480
|
)
|
|
466
481
|
super().__init__(
|
|
467
482
|
flows=flows,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fastapi
|
|
3
|
-
Version: 0.115.
|
|
3
|
+
Version: 0.115.13
|
|
4
4
|
Summary: FastAPI framework, high performance, easy to learn, fast to code, ready for production
|
|
5
5
|
Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
|
|
6
6
|
Classifier: Intended Audience :: Information Technology
|
|
@@ -113,22 +113,20 @@ The key features are:
|
|
|
113
113
|
|
|
114
114
|
<a href="https://blockbee.io?ref=fastapi" target="_blank" title="BlockBee Cryptocurrency Payment Gateway"><img src="https://fastapi.tiangolo.com/img/sponsors/blockbee.png"></a>
|
|
115
115
|
<a href="https://platform.sh/try-it-now/?utm_source=fastapi-signup&utm_medium=banner&utm_campaign=FastAPI-signup-June-2023" target="_blank" title="Build, run and scale your apps on a modern, reliable, and secure PaaS."><img src="https://fastapi.tiangolo.com/img/sponsors/platform-sh.png"></a>
|
|
116
|
-
<a href="https://www.porter.run" target="_blank" title="Deploy FastAPI on AWS with a few clicks"><img src="https://fastapi.tiangolo.com/img/sponsors/porter.png"></a>
|
|
117
|
-
<a href="https://bump.sh/fastapi?utm_source=fastapi&utm_medium=referral&utm_campaign=sponsor" target="_blank" title="Automate FastAPI documentation generation with Bump.sh"><img src="https://fastapi.tiangolo.com/img/sponsors/bump-sh.svg"></a>
|
|
118
116
|
<a href="https://github.com/scalar/scalar/?utm_source=fastapi&utm_medium=website&utm_campaign=main-badge" target="_blank" title="Scalar: Beautiful Open-Source API References from Swagger/OpenAPI files"><img src="https://fastapi.tiangolo.com/img/sponsors/scalar.svg"></a>
|
|
119
117
|
<a href="https://www.propelauth.com/?utm_source=fastapi&utm_campaign=1223&utm_medium=mainbadge" target="_blank" title="Auth, user management and more for your B2B product"><img src="https://fastapi.tiangolo.com/img/sponsors/propelauth.png"></a>
|
|
120
|
-
<a href="https://
|
|
121
|
-
<a href="https://www.mongodb.com/developer/languages/python/python-quickstart-fastapi/?utm_campaign=fastapi_framework&utm_source=fastapi_sponsorship&utm_medium=web_referral" target="_blank" title="Simplify Full Stack Development with FastAPI & MongoDB"><img src="https://fastapi.tiangolo.com/img/sponsors/mongodb.png"></a>
|
|
122
|
-
<a href="https://zuplo.link/fastapi-gh" target="_blank" title="Zuplo: Scale, Protect, Document, and Monetize your FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/zuplo.png"></a>
|
|
118
|
+
<a href="https://zuplo.link/fastapi-gh" target="_blank" title="Zuplo: Deploy, Secure, Document, and Monetize your FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/zuplo.png"></a>
|
|
123
119
|
<a href="https://liblab.com?utm_source=fastapi" target="_blank" title="liblab - Generate SDKs from FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/liblab.png"></a>
|
|
124
120
|
<a href="https://docs.render.com/deploy-fastapi?utm_source=deploydoc&utm_medium=referral&utm_campaign=fastapi" target="_blank" title="Deploy & scale any full-stack web app on Render. Focus on building apps, not infra."><img src="https://fastapi.tiangolo.com/img/sponsors/render.svg"></a>
|
|
125
121
|
<a href="https://www.coderabbit.ai/?utm_source=fastapi&utm_medium=badge&utm_campaign=fastapi" target="_blank" title="Cut Code Review Time & Bugs in Half with CodeRabbit"><img src="https://fastapi.tiangolo.com/img/sponsors/coderabbit.png"></a>
|
|
126
|
-
<a href="https://
|
|
122
|
+
<a href="https://subtotal.com/?utm_source=fastapi&utm_medium=sponsorship&utm_campaign=open-source" target="_blank" title="The Gold Standard in Retail Account Linking"><img src="https://fastapi.tiangolo.com/img/sponsors/subtotal.svg"></a>
|
|
127
123
|
<a href="https://databento.com/" target="_blank" title="Pay as you go for market data"><img src="https://fastapi.tiangolo.com/img/sponsors/databento.svg"></a>
|
|
128
124
|
<a href="https://speakeasy.com?utm_source=fastapi+repo&utm_medium=github+sponsorship" target="_blank" title="SDKs for your API | Speakeasy"><img src="https://fastapi.tiangolo.com/img/sponsors/speakeasy.png"></a>
|
|
129
125
|
<a href="https://www.svix.com/" target="_blank" title="Svix - Webhooks as a service"><img src="https://fastapi.tiangolo.com/img/sponsors/svix.svg"></a>
|
|
130
126
|
<a href="https://www.stainlessapi.com/?utm_source=fastapi&utm_medium=referral" target="_blank" title="Stainless | Generate best-in-class SDKs"><img src="https://fastapi.tiangolo.com/img/sponsors/stainless.png"></a>
|
|
131
127
|
<a href="https://www.permit.io/blog/implement-authorization-in-fastapi?utm_source=github&utm_medium=referral&utm_campaign=fastapi" target="_blank" title="Fine-Grained Authorization for FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/permit.png"></a>
|
|
128
|
+
<a href="https://www.interviewpal.com/?utm_source=fastapi&utm_medium=open-source&utm_campaign=dev-hiring" target="_blank" title="InterviewPal - AI Interview Coach for Engineers and Devs"><img src="https://fastapi.tiangolo.com/img/sponsors/interviewpal.png"></a>
|
|
129
|
+
<a href="https://dribia.com/en/" target="_blank" title="Dribia - Data Science within your reach"><img src="https://fastapi.tiangolo.com/img/sponsors/dribia.png"></a>
|
|
132
130
|
|
|
133
131
|
<!-- /sponsors -->
|
|
134
132
|
|
|
@@ -215,7 +213,7 @@ $ pip install "fastapi[standard]"
|
|
|
215
213
|
|
|
216
214
|
### Create it
|
|
217
215
|
|
|
218
|
-
|
|
216
|
+
Create a file `main.py` with:
|
|
219
217
|
|
|
220
218
|
```Python
|
|
221
219
|
from typing import Union
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
fastapi-0.115.
|
|
2
|
-
fastapi-0.115.
|
|
3
|
-
fastapi-0.115.
|
|
4
|
-
fastapi-0.115.
|
|
5
|
-
fastapi/__init__.py,sha256=
|
|
1
|
+
fastapi-0.115.13.dist-info/METADATA,sha256=PvkM6vxD1dHOg7eAs7JPr8olyYKslTLsNCK1hpvIL8I,27173
|
|
2
|
+
fastapi-0.115.13.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
|
3
|
+
fastapi-0.115.13.dist-info/entry_points.txt,sha256=GCf-WbIZxyGT4MUmrPGj1cOHYZoGsNPHAvNkT6hnGeA,61
|
|
4
|
+
fastapi-0.115.13.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
|
|
5
|
+
fastapi/__init__.py,sha256=j0jm3ny0FgOG3Y0IGGiJ3N1q3mTPnHbo1IybrHXq7d0,1082
|
|
6
6
|
fastapi/__main__.py,sha256=bKePXLdO4SsVSM6r9SVoLickJDcR2c0cTOxZRKq26YQ,37
|
|
7
|
-
fastapi/_compat.py,sha256=
|
|
8
|
-
fastapi/applications.py,sha256=
|
|
7
|
+
fastapi/_compat.py,sha256=PwGTZd6d-u2o6YF9M8pQahuBtD_3q3Kpj7vU5-ngChc,24228
|
|
8
|
+
fastapi/applications.py,sha256=rZTr0Ix-vdMwh6MQGCI_NC-Ir9lpfIGHHBY-JnNWZ_E,176550
|
|
9
9
|
fastapi/background.py,sha256=rouLirxUANrcYC824MSMypXL_Qb2HYg2YZqaiEqbEKI,1768
|
|
10
10
|
fastapi/cli.py,sha256=OYhZb0NR_deuT5ofyPF2NoNBzZDNOP8Salef2nk-HqA,418
|
|
11
11
|
fastapi/concurrency.py,sha256=MirfowoSpkMQZ8j_g0ZxaQKpV6eB3G-dB5TgcXCrgEA,1424
|
|
12
12
|
fastapi/datastructures.py,sha256=b2PEz77XGq-u3Ur1Inwk0AGjOsQZO49yF9C7IPJ15cY,5766
|
|
13
13
|
fastapi/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
fastapi/dependencies/models.py,sha256=Pjl6vx-4nZ5Tta9kJa3-RfQKkXtCpS09-FhMgs9eWNs,1507
|
|
15
|
-
fastapi/dependencies/utils.py,sha256=
|
|
15
|
+
fastapi/dependencies/utils.py,sha256=SwOOdQYOC0E4thJ-n1a0ohslWN9duyasNY_JBdWPTsY,35971
|
|
16
16
|
fastapi/encoders.py,sha256=LvwYmFeOz4tVwvgBoC5rvZnbr7hZr73KGrU8O7zSptU,11068
|
|
17
17
|
fastapi/exception_handlers.py,sha256=MBrIOA-ugjJDivIi4rSsUJBdTsjuzN76q4yh0q1COKw,1332
|
|
18
18
|
fastapi/exceptions.py,sha256=taNixuFEXb67lI1bnX1ubq8y8TseJ4yoPlWjyP0fTzk,4969
|
|
@@ -25,20 +25,20 @@ fastapi/middleware/trustedhost.py,sha256=eE5XGRxGa7c5zPnMJDGp3BxaL25k5iVQlhnv-Pk
|
|
|
25
25
|
fastapi/middleware/wsgi.py,sha256=Z3Ue-7wni4lUZMvH3G9ek__acgYdJstbnpZX_HQAboY,79
|
|
26
26
|
fastapi/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
fastapi/openapi/constants.py,sha256=adGzmis1L1HJRTE3kJ5fmHS_Noq6tIY6pWv_SFzoFDU,153
|
|
28
|
-
fastapi/openapi/docs.py,sha256=
|
|
28
|
+
fastapi/openapi/docs.py,sha256=zSDv4xY6XHcKsaG4zyk1HqSnrZtfZFBB0J7ZBk5YHPE,10345
|
|
29
29
|
fastapi/openapi/models.py,sha256=PqkxQiqcEgjKuhfUIWPZPQcyTcubtUCB3vcObLsB7VE,15397
|
|
30
|
-
fastapi/openapi/utils.py,sha256=
|
|
30
|
+
fastapi/openapi/utils.py,sha256=e00G_p0IdpiffBUaq31BUyiloXbpld8RryKYnYKisdY,23964
|
|
31
31
|
fastapi/param_functions.py,sha256=JHNPLIYvoAwdnZZavIVsxOat8x23fX_Kl33reh7HKl8,64019
|
|
32
32
|
fastapi/params.py,sha256=g450axUBQgQJODdtM7WBxZbQj9Z64inFvadrgHikBbU,28237
|
|
33
33
|
fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
fastapi/requests.py,sha256=zayepKFcienBllv3snmWI20Gk0oHNVLU4DDhqXBb4LU,142
|
|
35
35
|
fastapi/responses.py,sha256=QNQQlwpKhQoIPZTTWkpc9d_QGeGZ_aVQPaDV3nQ8m7c,1761
|
|
36
|
-
fastapi/routing.py,sha256=
|
|
36
|
+
fastapi/routing.py,sha256=gnGRnOzM-CBOYj7hI0bZlC_5c-RQKh6BPmlsDD8IVUo,176315
|
|
37
37
|
fastapi/security/__init__.py,sha256=bO8pNmxqVRXUjfl2mOKiVZLn0FpBQ61VUYVjmppnbJw,881
|
|
38
38
|
fastapi/security/api_key.py,sha256=cBI5Z4zWVjL1uJrsjTeLy7MafHPAO2HQPzTrpyoIYWA,9094
|
|
39
39
|
fastapi/security/base.py,sha256=dl4pvbC-RxjfbWgPtCWd8MVU-7CB2SZ22rJDXVCXO6c,141
|
|
40
40
|
fastapi/security/http.py,sha256=rWR2x-5CUsjWmRucYthwRig6MG1o-boyrr4Xo-PuuxU,13606
|
|
41
|
-
fastapi/security/oauth2.py,sha256=
|
|
41
|
+
fastapi/security/oauth2.py,sha256=M1AFIDT7G3oQChq83poI3eg8ZDeibcvnGmya2CTS7JY,22036
|
|
42
42
|
fastapi/security/open_id_connect_url.py,sha256=8vizZ2tGqEp1ur8SwtVgyHJhGAJ5AqahgcvSpaIioDI,2722
|
|
43
43
|
fastapi/security/utils.py,sha256=bd8T0YM7UQD5ATKucr1bNtAvz_Y3__dVNAv5UebiPvc,293
|
|
44
44
|
fastapi/staticfiles.py,sha256=iirGIt3sdY2QZXd36ijs3Cj-T0FuGFda3cd90kM9Ikw,69
|
|
@@ -47,4 +47,4 @@ fastapi/testclient.py,sha256=nBvaAmX66YldReJNZXPOk1sfuo2Q6hs8bOvIaCep6LQ,66
|
|
|
47
47
|
fastapi/types.py,sha256=nFb36sK3DSoqoyo7Miwy3meKK5UdFBgkAgLSzQlUVyI,383
|
|
48
48
|
fastapi/utils.py,sha256=y8Bj5ttMaI9tS4D60OUgXqKnktBr99NdYUnHHV9LgoY,7948
|
|
49
49
|
fastapi/websockets.py,sha256=419uncYObEKZG0YcrXscfQQYLSWoE10jqxVMetGdR98,222
|
|
50
|
-
fastapi-0.115.
|
|
50
|
+
fastapi-0.115.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|