fastapi 0.120.1__py3-none-any.whl → 0.120.3__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/v2.py +24 -4
- fastapi/dependencies/utils.py +28 -56
- fastapi/params.py +6 -19
- {fastapi-0.120.1.dist-info → fastapi-0.120.3.dist-info}/METADATA +2 -1
- {fastapi-0.120.1.dist-info → fastapi-0.120.3.dist-info}/RECORD +9 -9
- {fastapi-0.120.1.dist-info → fastapi-0.120.3.dist-info}/WHEEL +0 -0
- {fastapi-0.120.1.dist-info → fastapi-0.120.3.dist-info}/entry_points.txt +0 -0
- {fastapi-0.120.1.dist-info → fastapi-0.120.3.dist-info}/licenses/LICENSE +0 -0
fastapi/__init__.py
CHANGED
fastapi/_compat/v2.py
CHANGED
|
@@ -207,11 +207,31 @@ def get_definitions(
|
|
|
207
207
|
override_mode: Union[Literal["validation"], None] = (
|
|
208
208
|
None if separate_input_output_schemas else "validation"
|
|
209
209
|
)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
validation_fields = [field for field in fields if field.mode == "validation"]
|
|
211
|
+
serialization_fields = [field for field in fields if field.mode == "serialization"]
|
|
212
|
+
flat_validation_models = get_flat_models_from_fields(
|
|
213
|
+
validation_fields, known_models=set()
|
|
214
|
+
)
|
|
215
|
+
flat_serialization_models = get_flat_models_from_fields(
|
|
216
|
+
serialization_fields, known_models=set()
|
|
217
|
+
)
|
|
218
|
+
flat_validation_model_fields = [
|
|
219
|
+
ModelField(
|
|
220
|
+
field_info=FieldInfo(annotation=model),
|
|
221
|
+
name=model.__name__,
|
|
222
|
+
mode="validation",
|
|
223
|
+
)
|
|
224
|
+
for model in flat_validation_models
|
|
225
|
+
]
|
|
226
|
+
flat_serialization_model_fields = [
|
|
227
|
+
ModelField(
|
|
228
|
+
field_info=FieldInfo(annotation=model),
|
|
229
|
+
name=model.__name__,
|
|
230
|
+
mode="serialization",
|
|
231
|
+
)
|
|
232
|
+
for model in flat_serialization_models
|
|
214
233
|
]
|
|
234
|
+
flat_model_fields = flat_validation_model_fields + flat_serialization_model_fields
|
|
215
235
|
input_types = {f.type_ for f in fields}
|
|
216
236
|
unique_flat_model_fields = {
|
|
217
237
|
f for f in flat_model_fields if f.type_ not in input_types
|
fastapi/dependencies/utils.py
CHANGED
|
@@ -125,60 +125,16 @@ def ensure_multipart_is_installed() -> None:
|
|
|
125
125
|
raise RuntimeError(multipart_not_installed_error) from None
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
def get_param_sub_dependant(
|
|
129
|
-
*,
|
|
130
|
-
param_name: str,
|
|
131
|
-
depends: params.Depends,
|
|
132
|
-
path: str,
|
|
133
|
-
security_scopes: Optional[List[str]] = None,
|
|
134
|
-
) -> Dependant:
|
|
135
|
-
assert depends.dependency
|
|
136
|
-
return get_sub_dependant(
|
|
137
|
-
depends=depends,
|
|
138
|
-
dependency=depends.dependency,
|
|
139
|
-
path=path,
|
|
140
|
-
name=param_name,
|
|
141
|
-
security_scopes=security_scopes,
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
|
|
145
128
|
def get_parameterless_sub_dependant(*, depends: params.Depends, path: str) -> Dependant:
|
|
146
129
|
assert callable(depends.dependency), (
|
|
147
130
|
"A parameter-less dependency must have a callable dependency"
|
|
148
131
|
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
depends: params.Depends,
|
|
155
|
-
dependency: Callable[..., Any],
|
|
156
|
-
path: str,
|
|
157
|
-
name: Optional[str] = None,
|
|
158
|
-
security_scopes: Optional[List[str]] = None,
|
|
159
|
-
) -> Dependant:
|
|
160
|
-
security_requirement = None
|
|
161
|
-
security_scopes = security_scopes or []
|
|
162
|
-
if isinstance(depends, params.Security):
|
|
163
|
-
dependency_scopes = depends.scopes
|
|
164
|
-
security_scopes.extend(dependency_scopes)
|
|
165
|
-
if isinstance(dependency, SecurityBase):
|
|
166
|
-
use_scopes: List[str] = []
|
|
167
|
-
if isinstance(dependency, (OAuth2, OpenIdConnect)):
|
|
168
|
-
use_scopes = security_scopes
|
|
169
|
-
security_requirement = SecurityRequirement(
|
|
170
|
-
security_scheme=dependency, scopes=use_scopes
|
|
171
|
-
)
|
|
172
|
-
sub_dependant = get_dependant(
|
|
173
|
-
path=path,
|
|
174
|
-
call=dependency,
|
|
175
|
-
name=name,
|
|
176
|
-
security_scopes=security_scopes,
|
|
177
|
-
use_cache=depends.use_cache,
|
|
132
|
+
use_security_scopes: List[str] = []
|
|
133
|
+
if isinstance(depends, params.Security) and depends.scopes:
|
|
134
|
+
use_security_scopes.extend(depends.scopes)
|
|
135
|
+
return get_dependant(
|
|
136
|
+
path=path, call=depends.dependency, security_scopes=use_security_scopes
|
|
178
137
|
)
|
|
179
|
-
if security_requirement:
|
|
180
|
-
sub_dependant.security_requirements.append(security_requirement)
|
|
181
|
-
return sub_dependant
|
|
182
138
|
|
|
183
139
|
|
|
184
140
|
CacheKey = Tuple[Optional[Callable[..., Any]], Tuple[str, ...]]
|
|
@@ -282,9 +238,6 @@ def get_dependant(
|
|
|
282
238
|
security_scopes: Optional[List[str]] = None,
|
|
283
239
|
use_cache: bool = True,
|
|
284
240
|
) -> Dependant:
|
|
285
|
-
path_param_names = get_path_param_names(path)
|
|
286
|
-
endpoint_signature = get_typed_signature(call)
|
|
287
|
-
signature_params = endpoint_signature.parameters
|
|
288
241
|
dependant = Dependant(
|
|
289
242
|
call=call,
|
|
290
243
|
name=name,
|
|
@@ -292,6 +245,9 @@ def get_dependant(
|
|
|
292
245
|
security_scopes=security_scopes,
|
|
293
246
|
use_cache=use_cache,
|
|
294
247
|
)
|
|
248
|
+
path_param_names = get_path_param_names(path)
|
|
249
|
+
endpoint_signature = get_typed_signature(call)
|
|
250
|
+
signature_params = endpoint_signature.parameters
|
|
295
251
|
for param_name, param in signature_params.items():
|
|
296
252
|
is_path_param = param_name in path_param_names
|
|
297
253
|
param_details = analyze_param(
|
|
@@ -301,12 +257,28 @@ def get_dependant(
|
|
|
301
257
|
is_path_param=is_path_param,
|
|
302
258
|
)
|
|
303
259
|
if param_details.depends is not None:
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
260
|
+
assert param_details.depends.dependency
|
|
261
|
+
use_security_scopes = security_scopes or []
|
|
262
|
+
if isinstance(param_details.depends, params.Security):
|
|
263
|
+
if param_details.depends.scopes:
|
|
264
|
+
use_security_scopes.extend(param_details.depends.scopes)
|
|
265
|
+
sub_dependant = get_dependant(
|
|
307
266
|
path=path,
|
|
308
|
-
|
|
267
|
+
call=param_details.depends.dependency,
|
|
268
|
+
name=param_name,
|
|
269
|
+
security_scopes=use_security_scopes,
|
|
270
|
+
use_cache=param_details.depends.use_cache,
|
|
309
271
|
)
|
|
272
|
+
if isinstance(param_details.depends.dependency, SecurityBase):
|
|
273
|
+
use_scopes: List[str] = []
|
|
274
|
+
if isinstance(
|
|
275
|
+
param_details.depends.dependency, (OAuth2, OpenIdConnect)
|
|
276
|
+
):
|
|
277
|
+
use_scopes = use_security_scopes
|
|
278
|
+
security_requirement = SecurityRequirement(
|
|
279
|
+
security_scheme=param_details.depends.dependency, scopes=use_scopes
|
|
280
|
+
)
|
|
281
|
+
sub_dependant.security_requirements.append(security_requirement)
|
|
310
282
|
dependant.dependencies.append(sub_dependant)
|
|
311
283
|
continue
|
|
312
284
|
if add_non_field_param_to_dependency(
|
fastapi/params.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import warnings
|
|
2
|
+
from dataclasses import dataclass
|
|
2
3
|
from enum import Enum
|
|
3
4
|
from typing import Any, Callable, Dict, List, Optional, Sequence, Union
|
|
4
5
|
|
|
@@ -761,26 +762,12 @@ class File(Form): # type: ignore[misc]
|
|
|
761
762
|
)
|
|
762
763
|
|
|
763
764
|
|
|
765
|
+
@dataclass
|
|
764
766
|
class Depends:
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
):
|
|
768
|
-
self.dependency = dependency
|
|
769
|
-
self.use_cache = use_cache
|
|
770
|
-
|
|
771
|
-
def __repr__(self) -> str:
|
|
772
|
-
attr = getattr(self.dependency, "__name__", type(self.dependency).__name__)
|
|
773
|
-
cache = "" if self.use_cache else ", use_cache=False"
|
|
774
|
-
return f"{self.__class__.__name__}({attr}{cache})"
|
|
767
|
+
dependency: Optional[Callable[..., Any]] = None
|
|
768
|
+
use_cache: bool = True
|
|
775
769
|
|
|
776
770
|
|
|
771
|
+
@dataclass
|
|
777
772
|
class Security(Depends):
|
|
778
|
-
|
|
779
|
-
self,
|
|
780
|
-
dependency: Optional[Callable[..., Any]] = None,
|
|
781
|
-
*,
|
|
782
|
-
scopes: Optional[Sequence[str]] = None,
|
|
783
|
-
use_cache: bool = True,
|
|
784
|
-
):
|
|
785
|
-
super().__init__(dependency=dependency, use_cache=use_cache)
|
|
786
|
-
self.scopes = scopes or []
|
|
773
|
+
scopes: Optional[Sequence[str]] = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi
|
|
3
|
-
Version: 0.120.
|
|
3
|
+
Version: 0.120.3
|
|
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
|
License-Expression: MIT
|
|
@@ -130,6 +130,7 @@ The key features are:
|
|
|
130
130
|
<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>
|
|
131
131
|
<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>
|
|
132
132
|
<a href="https://docs.railway.com/guides/fastapi?utm_medium=integration&utm_source=docs&utm_campaign=fastapi" target="_blank" title="Deploy enterprise applications at startup speed"><img src="https://fastapi.tiangolo.com/img/sponsors/railway.png"></a>
|
|
133
|
+
<a href="https://serpapi.com/?utm_source=fastapi_website" target="_blank" title="SerpApi: Web Search API"><img src="https://fastapi.tiangolo.com/img/sponsors/serpapi.png"></a>
|
|
133
134
|
<a href="https://databento.com/?utm_source=fastapi&utm_medium=sponsor&utm_content=display" target="_blank" title="Pay as you go for market data"><img src="https://fastapi.tiangolo.com/img/sponsors/databento.svg"></a>
|
|
134
135
|
<a href="https://speakeasy.com/editor?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>
|
|
135
136
|
<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>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
fastapi-0.120.
|
|
2
|
-
fastapi-0.120.
|
|
3
|
-
fastapi-0.120.
|
|
4
|
-
fastapi-0.120.
|
|
5
|
-
fastapi/__init__.py,sha256=
|
|
1
|
+
fastapi-0.120.3.dist-info/METADATA,sha256=FtKxo8gfHGyTCa8jQV0CjwJlL7gV01Hq_oOO1LV8tgY,28394
|
|
2
|
+
fastapi-0.120.3.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
fastapi-0.120.3.dist-info/entry_points.txt,sha256=GCf-WbIZxyGT4MUmrPGj1cOHYZoGsNPHAvNkT6hnGeA,61
|
|
4
|
+
fastapi-0.120.3.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
|
|
5
|
+
fastapi/__init__.py,sha256=PTCa4i_e9zIhH_lBO383KH1rUF-o6N2J7S81vy5a1Ao,1081
|
|
6
6
|
fastapi/__main__.py,sha256=bKePXLdO4SsVSM6r9SVoLickJDcR2c0cTOxZRKq26YQ,37
|
|
7
7
|
fastapi/_compat/__init__.py,sha256=8fa5XmM6_whr6YWuCs7KDdKR_gZ_AMmaxYW7GDn0eng,2718
|
|
8
8
|
fastapi/_compat/main.py,sha256=WDixlh9_5nfFuwWvbYQJNi8l5nDZdfbl2nMyTriG65c,10978
|
|
@@ -10,7 +10,7 @@ fastapi/_compat/may_v1.py,sha256=uiZpZTEVHBlD_Q3WYUW_BNW24X3yk_OwvHhCgPwTUco,297
|
|
|
10
10
|
fastapi/_compat/model_field.py,sha256=SrSoXEcloGXKAqjR8UDW2869RPgLRFdWTuVgTBhX_Gw,1190
|
|
11
11
|
fastapi/_compat/shared.py,sha256=KPOKDRBmM4mzGLdRZwDyrTIph6Eud9Vb2vil1dxNdV0,7030
|
|
12
12
|
fastapi/_compat/v1.py,sha256=v_YLzo8uyr0HeA7QxNbgaSb332kCcBK9-9PZmOHGkq8,10325
|
|
13
|
-
fastapi/_compat/v2.py,sha256=
|
|
13
|
+
fastapi/_compat/v2.py,sha256=rrQth5LW-k8B0XzZUj6Vj0vpccvwnD5PwlC5OvFxqCY,16577
|
|
14
14
|
fastapi/applications.py,sha256=LMSC56YSekA9_D8LwIkPSJxAEAqltWjTJg9PU0GO6fc,180303
|
|
15
15
|
fastapi/background.py,sha256=YWxNdBckdgMLJlwJJT2sR5NJpkVXQVdbYuuyj8zUYsk,1793
|
|
16
16
|
fastapi/cli.py,sha256=OYhZb0NR_deuT5ofyPF2NoNBzZDNOP8Salef2nk-HqA,418
|
|
@@ -18,7 +18,7 @@ fastapi/concurrency.py,sha256=MirfowoSpkMQZ8j_g0ZxaQKpV6eB3G-dB5TgcXCrgEA,1424
|
|
|
18
18
|
fastapi/datastructures.py,sha256=VnWKzzE1EW7KLOTRNWeEqlIoJQASCfgdKOOu5EM3H9A,5813
|
|
19
19
|
fastapi/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
fastapi/dependencies/models.py,sha256=Pjl6vx-4nZ5Tta9kJa3-RfQKkXtCpS09-FhMgs9eWNs,1507
|
|
21
|
-
fastapi/dependencies/utils.py,sha256=
|
|
21
|
+
fastapi/dependencies/utils.py,sha256=G-3O-cwfRw5G47in_LkTXwKXmdPHKwQKYlTXYyRY3PA,38298
|
|
22
22
|
fastapi/encoders.py,sha256=KAMFJ0sz0FFl0Pg4sUiXiuq94av3mLdLZnzeYp9f4wM,11343
|
|
23
23
|
fastapi/exception_handlers.py,sha256=YVcT8Zy021VYYeecgdyh5YEUjEIHKcLspbkSf4OfbJI,1275
|
|
24
24
|
fastapi/exceptions.py,sha256=GuwxWZSXM44SbN3NCZXDfw9g2mNM5XM2FXOWPZkcOI4,4994
|
|
@@ -36,7 +36,7 @@ fastapi/openapi/docs.py,sha256=9Rypo8GU5gdp2S7SsoyIZSVGp5e3T2T1KTtJBYTCnRs,10370
|
|
|
36
36
|
fastapi/openapi/models.py,sha256=m1BNHxf_RiDTK1uCfMre6XZN5y7krZNA62QEP_2EV9s,15625
|
|
37
37
|
fastapi/openapi/utils.py,sha256=2DkhvMHoHLI58vK4vai_7v9WZ3R5RMB6dGDIAx3snGo,23255
|
|
38
38
|
fastapi/param_functions.py,sha256=4x6Y5xOjFmujLnbMDXxvF-kdr-l1mZ0bSOTDLoHYj6Q,64044
|
|
39
|
-
fastapi/params.py,sha256=
|
|
39
|
+
fastapi/params.py,sha256=5cIkxEkOxYu5junNilxI6UZhoIbaaq5kjhAY2rvrg48,27877
|
|
40
40
|
fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
41
|
fastapi/requests.py,sha256=zayepKFcienBllv3snmWI20Gk0oHNVLU4DDhqXBb4LU,142
|
|
42
42
|
fastapi/responses.py,sha256=QNQQlwpKhQoIPZTTWkpc9d_QGeGZ_aVQPaDV3nQ8m7c,1761
|
|
@@ -55,4 +55,4 @@ fastapi/testclient.py,sha256=nBvaAmX66YldReJNZXPOk1sfuo2Q6hs8bOvIaCep6LQ,66
|
|
|
55
55
|
fastapi/types.py,sha256=nFb36sK3DSoqoyo7Miwy3meKK5UdFBgkAgLSzQlUVyI,383
|
|
56
56
|
fastapi/utils.py,sha256=Nedm_1OJnL12uHJ85HTPCO-AHfwxCtXObFpBi_0X4xQ,9010
|
|
57
57
|
fastapi/websockets.py,sha256=419uncYObEKZG0YcrXscfQQYLSWoE10jqxVMetGdR98,222
|
|
58
|
-
fastapi-0.120.
|
|
58
|
+
fastapi-0.120.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|