fastapi 0.110.1__py3-none-any.whl → 0.110.3.dev1__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  """FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
2
2
 
3
- __version__ = "0.110.1"
3
+ __version__ = "0.110.3.dev1"
4
4
 
5
5
  from starlette import status as status
6
6
 
fastapi/_compat.py CHANGED
@@ -20,10 +20,12 @@ from typing import (
20
20
  from fastapi.exceptions import RequestErrorModel
21
21
  from fastapi.types import IncEx, ModelNameMap, UnionType
22
22
  from pydantic import BaseModel, create_model
23
- from pydantic.version import VERSION as PYDANTIC_VERSION
23
+ from pydantic.version import VERSION as P_VERSION
24
24
  from starlette.datastructures import UploadFile
25
25
  from typing_extensions import Annotated, Literal, get_args, get_origin
26
26
 
27
+ # Reassign variable to make it reexported for mypy
28
+ PYDANTIC_VERSION = P_VERSION
27
29
  PYDANTIC_V2 = PYDANTIC_VERSION.startswith("2.")
28
30
 
29
31
 
@@ -127,7 +129,7 @@ if PYDANTIC_V2:
127
129
  )
128
130
  except ValidationError as exc:
129
131
  return None, _regenerate_error_with_loc(
130
- errors=exc.errors(), loc_prefix=loc
132
+ errors=exc.errors(include_url=False), loc_prefix=loc
131
133
  )
132
134
 
133
135
  def serialize(
@@ -266,7 +268,7 @@ if PYDANTIC_V2:
266
268
  def get_missing_field_error(loc: Tuple[str, ...]) -> Dict[str, Any]:
267
269
  error = ValidationError.from_exception_data(
268
270
  "Field required", [{"type": "missing", "loc": loc, "input": {}}]
269
- ).errors()[0]
271
+ ).errors(include_url=False)[0]
270
272
  error["input"] = None
271
273
  return error # type: ignore[return-value]
272
274
 
fastapi/encoders.py CHANGED
@@ -24,7 +24,7 @@ from pydantic.networks import AnyUrl, NameEmail
24
24
  from pydantic.types import SecretBytes, SecretStr
25
25
  from typing_extensions import Annotated, Doc
26
26
 
27
- from ._compat import PYDANTIC_V2, Url, _model_dump
27
+ from ._compat import PYDANTIC_V2, UndefinedType, Url, _model_dump
28
28
 
29
29
 
30
30
  # Taken from Pydantic v1 as is
@@ -259,6 +259,8 @@ def jsonable_encoder(
259
259
  return str(obj)
260
260
  if isinstance(obj, (str, int, float, type(None))):
261
261
  return obj
262
+ if isinstance(obj, UndefinedType):
263
+ return None
262
264
  if isinstance(obj, dict):
263
265
  encoded_dict = {}
264
266
  allowed_keys = set(obj.keys())
fastapi/openapi/models.py CHANGED
@@ -55,11 +55,7 @@ except ImportError: # pragma: no cover
55
55
  return with_info_plain_validator_function(cls._validate)
56
56
 
57
57
 
58
- class Contact(BaseModel):
59
- name: Optional[str] = None
60
- url: Optional[AnyUrl] = None
61
- email: Optional[EmailStr] = None
62
-
58
+ class BaseModelWithConfig(BaseModel):
63
59
  if PYDANTIC_V2:
64
60
  model_config = {"extra": "allow"}
65
61
 
@@ -69,21 +65,19 @@ class Contact(BaseModel):
69
65
  extra = "allow"
70
66
 
71
67
 
72
- class License(BaseModel):
73
- name: str
74
- identifier: Optional[str] = None
68
+ class Contact(BaseModelWithConfig):
69
+ name: Optional[str] = None
75
70
  url: Optional[AnyUrl] = None
71
+ email: Optional[EmailStr] = None
76
72
 
77
- if PYDANTIC_V2:
78
- model_config = {"extra": "allow"}
79
-
80
- else:
81
73
 
82
- class Config:
83
- extra = "allow"
74
+ class License(BaseModelWithConfig):
75
+ name: str
76
+ identifier: Optional[str] = None
77
+ url: Optional[AnyUrl] = None
84
78
 
85
79
 
86
- class Info(BaseModel):
80
+ class Info(BaseModelWithConfig):
87
81
  title: str
88
82
  summary: Optional[str] = None
89
83
  description: Optional[str] = None
@@ -92,42 +86,18 @@ class Info(BaseModel):
92
86
  license: Optional[License] = None
93
87
  version: str
94
88
 
95
- if PYDANTIC_V2:
96
- model_config = {"extra": "allow"}
97
-
98
- else:
99
89
 
100
- class Config:
101
- extra = "allow"
102
-
103
-
104
- class ServerVariable(BaseModel):
90
+ class ServerVariable(BaseModelWithConfig):
105
91
  enum: Annotated[Optional[List[str]], Field(min_length=1)] = None
106
92
  default: str
107
93
  description: Optional[str] = None
108
94
 
109
- if PYDANTIC_V2:
110
- model_config = {"extra": "allow"}
111
-
112
- else:
113
95
 
114
- class Config:
115
- extra = "allow"
116
-
117
-
118
- class Server(BaseModel):
96
+ class Server(BaseModelWithConfig):
119
97
  url: Union[AnyUrl, str]
120
98
  description: Optional[str] = None
121
99
  variables: Optional[Dict[str, ServerVariable]] = None
122
100
 
123
- if PYDANTIC_V2:
124
- model_config = {"extra": "allow"}
125
-
126
- else:
127
-
128
- class Config:
129
- extra = "allow"
130
-
131
101
 
132
102
  class Reference(BaseModel):
133
103
  ref: str = Field(alias="$ref")
@@ -138,36 +108,20 @@ class Discriminator(BaseModel):
138
108
  mapping: Optional[Dict[str, str]] = None
139
109
 
140
110
 
141
- class XML(BaseModel):
111
+ class XML(BaseModelWithConfig):
142
112
  name: Optional[str] = None
143
113
  namespace: Optional[str] = None
144
114
  prefix: Optional[str] = None
145
115
  attribute: Optional[bool] = None
146
116
  wrapped: Optional[bool] = None
147
117
 
148
- if PYDANTIC_V2:
149
- model_config = {"extra": "allow"}
150
-
151
- else:
152
118
 
153
- class Config:
154
- extra = "allow"
155
-
156
-
157
- class ExternalDocumentation(BaseModel):
119
+ class ExternalDocumentation(BaseModelWithConfig):
158
120
  description: Optional[str] = None
159
121
  url: AnyUrl
160
122
 
161
- if PYDANTIC_V2:
162
- model_config = {"extra": "allow"}
163
-
164
- else:
165
-
166
- class Config:
167
- extra = "allow"
168
-
169
123
 
170
- class Schema(BaseModel):
124
+ class Schema(BaseModelWithConfig):
171
125
  # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-the-json-schema-core-vocabu
172
126
  # Core Vocabulary
173
127
  schema_: Optional[str] = Field(default=None, alias="$schema")
@@ -253,14 +207,6 @@ class Schema(BaseModel):
253
207
  ),
254
208
  ] = None
255
209
 
256
- if PYDANTIC_V2:
257
- model_config = {"extra": "allow"}
258
-
259
- else:
260
-
261
- class Config:
262
- extra = "allow"
263
-
264
210
 
265
211
  # Ref: https://json-schema.org/draft/2020-12/json-schema-core.html#name-json-schema-documents
266
212
  # A JSON Schema MUST be an object or a boolean.
@@ -289,38 +235,22 @@ class ParameterInType(Enum):
289
235
  cookie = "cookie"
290
236
 
291
237
 
292
- class Encoding(BaseModel):
238
+ class Encoding(BaseModelWithConfig):
293
239
  contentType: Optional[str] = None
294
240
  headers: Optional[Dict[str, Union["Header", Reference]]] = None
295
241
  style: Optional[str] = None
296
242
  explode: Optional[bool] = None
297
243
  allowReserved: Optional[bool] = None
298
244
 
299
- if PYDANTIC_V2:
300
- model_config = {"extra": "allow"}
301
-
302
- else:
303
-
304
- class Config:
305
- extra = "allow"
306
-
307
245
 
308
- class MediaType(BaseModel):
246
+ class MediaType(BaseModelWithConfig):
309
247
  schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema")
310
248
  example: Optional[Any] = None
311
249
  examples: Optional[Dict[str, Union[Example, Reference]]] = None
312
250
  encoding: Optional[Dict[str, Encoding]] = None
313
251
 
314
- if PYDANTIC_V2:
315
- model_config = {"extra": "allow"}
316
-
317
- else:
318
-
319
- class Config:
320
- extra = "allow"
321
-
322
252
 
323
- class ParameterBase(BaseModel):
253
+ class ParameterBase(BaseModelWithConfig):
324
254
  description: Optional[str] = None
325
255
  required: Optional[bool] = None
326
256
  deprecated: Optional[bool] = None
@@ -334,14 +264,6 @@ class ParameterBase(BaseModel):
334
264
  # Serialization rules for more complex scenarios
335
265
  content: Optional[Dict[str, MediaType]] = None
336
266
 
337
- if PYDANTIC_V2:
338
- model_config = {"extra": "allow"}
339
-
340
- else:
341
-
342
- class Config:
343
- extra = "allow"
344
-
345
267
 
346
268
  class Parameter(ParameterBase):
347
269
  name: str
@@ -352,21 +274,13 @@ class Header(ParameterBase):
352
274
  pass
353
275
 
354
276
 
355
- class RequestBody(BaseModel):
277
+ class RequestBody(BaseModelWithConfig):
356
278
  description: Optional[str] = None
357
279
  content: Dict[str, MediaType]
358
280
  required: Optional[bool] = None
359
281
 
360
- if PYDANTIC_V2:
361
- model_config = {"extra": "allow"}
362
-
363
- else:
364
282
 
365
- class Config:
366
- extra = "allow"
367
-
368
-
369
- class Link(BaseModel):
283
+ class Link(BaseModelWithConfig):
370
284
  operationRef: Optional[str] = None
371
285
  operationId: Optional[str] = None
372
286
  parameters: Optional[Dict[str, Union[Any, str]]] = None
@@ -374,31 +288,15 @@ class Link(BaseModel):
374
288
  description: Optional[str] = None
375
289
  server: Optional[Server] = None
376
290
 
377
- if PYDANTIC_V2:
378
- model_config = {"extra": "allow"}
379
-
380
- else:
381
-
382
- class Config:
383
- extra = "allow"
384
-
385
291
 
386
- class Response(BaseModel):
292
+ class Response(BaseModelWithConfig):
387
293
  description: str
388
294
  headers: Optional[Dict[str, Union[Header, Reference]]] = None
389
295
  content: Optional[Dict[str, MediaType]] = None
390
296
  links: Optional[Dict[str, Union[Link, Reference]]] = None
391
297
 
392
- if PYDANTIC_V2:
393
- model_config = {"extra": "allow"}
394
-
395
- else:
396
-
397
- class Config:
398
- extra = "allow"
399
-
400
298
 
401
- class Operation(BaseModel):
299
+ class Operation(BaseModelWithConfig):
402
300
  tags: Optional[List[str]] = None
403
301
  summary: Optional[str] = None
404
302
  description: Optional[str] = None
@@ -413,16 +311,8 @@ class Operation(BaseModel):
413
311
  security: Optional[List[Dict[str, List[str]]]] = None
414
312
  servers: Optional[List[Server]] = None
415
313
 
416
- if PYDANTIC_V2:
417
- model_config = {"extra": "allow"}
418
-
419
- else:
420
314
 
421
- class Config:
422
- extra = "allow"
423
-
424
-
425
- class PathItem(BaseModel):
315
+ class PathItem(BaseModelWithConfig):
426
316
  ref: Optional[str] = Field(default=None, alias="$ref")
427
317
  summary: Optional[str] = None
428
318
  description: Optional[str] = None
@@ -437,14 +327,6 @@ class PathItem(BaseModel):
437
327
  servers: Optional[List[Server]] = None
438
328
  parameters: Optional[List[Union[Parameter, Reference]]] = None
439
329
 
440
- if PYDANTIC_V2:
441
- model_config = {"extra": "allow"}
442
-
443
- else:
444
-
445
- class Config:
446
- extra = "allow"
447
-
448
330
 
449
331
  class SecuritySchemeType(Enum):
450
332
  apiKey = "apiKey"
@@ -453,18 +335,10 @@ class SecuritySchemeType(Enum):
453
335
  openIdConnect = "openIdConnect"
454
336
 
455
337
 
456
- class SecurityBase(BaseModel):
338
+ class SecurityBase(BaseModelWithConfig):
457
339
  type_: SecuritySchemeType = Field(alias="type")
458
340
  description: Optional[str] = None
459
341
 
460
- if PYDANTIC_V2:
461
- model_config = {"extra": "allow"}
462
-
463
- else:
464
-
465
- class Config:
466
- extra = "allow"
467
-
468
342
 
469
343
  class APIKeyIn(Enum):
470
344
  query = "query"
@@ -488,18 +362,10 @@ class HTTPBearer(HTTPBase):
488
362
  bearerFormat: Optional[str] = None
489
363
 
490
364
 
491
- class OAuthFlow(BaseModel):
365
+ class OAuthFlow(BaseModelWithConfig):
492
366
  refreshUrl: Optional[str] = None
493
367
  scopes: Dict[str, str] = {}
494
368
 
495
- if PYDANTIC_V2:
496
- model_config = {"extra": "allow"}
497
-
498
- else:
499
-
500
- class Config:
501
- extra = "allow"
502
-
503
369
 
504
370
  class OAuthFlowImplicit(OAuthFlow):
505
371
  authorizationUrl: str
@@ -518,20 +384,12 @@ class OAuthFlowAuthorizationCode(OAuthFlow):
518
384
  tokenUrl: str
519
385
 
520
386
 
521
- class OAuthFlows(BaseModel):
387
+ class OAuthFlows(BaseModelWithConfig):
522
388
  implicit: Optional[OAuthFlowImplicit] = None
523
389
  password: Optional[OAuthFlowPassword] = None
524
390
  clientCredentials: Optional[OAuthFlowClientCredentials] = None
525
391
  authorizationCode: Optional[OAuthFlowAuthorizationCode] = None
526
392
 
527
- if PYDANTIC_V2:
528
- model_config = {"extra": "allow"}
529
-
530
- else:
531
-
532
- class Config:
533
- extra = "allow"
534
-
535
393
 
536
394
  class OAuth2(SecurityBase):
537
395
  type_: SecuritySchemeType = Field(default=SecuritySchemeType.oauth2, alias="type")
@@ -548,7 +406,7 @@ class OpenIdConnect(SecurityBase):
548
406
  SecurityScheme = Union[APIKey, HTTPBase, OAuth2, OpenIdConnect, HTTPBearer]
549
407
 
550
408
 
551
- class Components(BaseModel):
409
+ class Components(BaseModelWithConfig):
552
410
  schemas: Optional[Dict[str, Union[Schema, Reference]]] = None
553
411
  responses: Optional[Dict[str, Union[Response, Reference]]] = None
554
412
  parameters: Optional[Dict[str, Union[Parameter, Reference]]] = None
@@ -561,30 +419,14 @@ class Components(BaseModel):
561
419
  callbacks: Optional[Dict[str, Union[Dict[str, PathItem], Reference, Any]]] = None
562
420
  pathItems: Optional[Dict[str, Union[PathItem, Reference]]] = None
563
421
 
564
- if PYDANTIC_V2:
565
- model_config = {"extra": "allow"}
566
-
567
- else:
568
-
569
- class Config:
570
- extra = "allow"
571
-
572
422
 
573
- class Tag(BaseModel):
423
+ class Tag(BaseModelWithConfig):
574
424
  name: str
575
425
  description: Optional[str] = None
576
426
  externalDocs: Optional[ExternalDocumentation] = None
577
427
 
578
- if PYDANTIC_V2:
579
- model_config = {"extra": "allow"}
580
-
581
- else:
582
-
583
- class Config:
584
- extra = "allow"
585
-
586
428
 
587
- class OpenAPI(BaseModel):
429
+ class OpenAPI(BaseModelWithConfig):
588
430
  openapi: str
589
431
  info: Info
590
432
  jsonSchemaDialect: Optional[str] = None
@@ -597,14 +439,6 @@ class OpenAPI(BaseModel):
597
439
  tags: Optional[List[Tag]] = None
598
440
  externalDocs: Optional[ExternalDocumentation] = None
599
441
 
600
- if PYDANTIC_V2:
601
- model_config = {"extra": "allow"}
602
-
603
- else:
604
-
605
- class Config:
606
- extra = "allow"
607
-
608
442
 
609
443
  _model_rebuild(Schema)
610
444
  _model_rebuild(Operation)
fastapi/openapi/utils.py CHANGED
@@ -123,7 +123,7 @@ def get_openapi_operation_parameters(
123
123
  elif field_info.example != Undefined:
124
124
  parameter["example"] = jsonable_encoder(field_info.example)
125
125
  if field_info.deprecated:
126
- parameter["deprecated"] = field_info.deprecated
126
+ parameter["deprecated"] = True
127
127
  parameters.append(parameter)
128
128
  return parameters
129
129
 
@@ -240,7 +240,7 @@ def Path( # noqa: N802
240
240
  ),
241
241
  ] = None,
242
242
  deprecated: Annotated[
243
- Optional[bool],
243
+ Union[deprecated, str, bool, None],
244
244
  Doc(
245
245
  """
246
246
  Mark this parameter field as deprecated.
@@ -565,7 +565,7 @@ def Query( # noqa: N802
565
565
  ),
566
566
  ] = None,
567
567
  deprecated: Annotated[
568
- Optional[bool],
568
+ Union[deprecated, str, bool, None],
569
569
  Doc(
570
570
  """
571
571
  Mark this parameter field as deprecated.
@@ -880,7 +880,7 @@ def Header( # noqa: N802
880
880
  ),
881
881
  ] = None,
882
882
  deprecated: Annotated[
883
- Optional[bool],
883
+ Union[deprecated, str, bool, None],
884
884
  Doc(
885
885
  """
886
886
  Mark this parameter field as deprecated.
@@ -1185,7 +1185,7 @@ def Cookie( # noqa: N802
1185
1185
  ),
1186
1186
  ] = None,
1187
1187
  deprecated: Annotated[
1188
- Optional[bool],
1188
+ Union[deprecated, str, bool, None],
1189
1189
  Doc(
1190
1190
  """
1191
1191
  Mark this parameter field as deprecated.
@@ -1512,7 +1512,7 @@ def Body( # noqa: N802
1512
1512
  ),
1513
1513
  ] = None,
1514
1514
  deprecated: Annotated[
1515
- Optional[bool],
1515
+ Union[deprecated, str, bool, None],
1516
1516
  Doc(
1517
1517
  """
1518
1518
  Mark this parameter field as deprecated.
@@ -1827,7 +1827,7 @@ def Form( # noqa: N802
1827
1827
  ),
1828
1828
  ] = None,
1829
1829
  deprecated: Annotated[
1830
- Optional[bool],
1830
+ Union[deprecated, str, bool, None],
1831
1831
  Doc(
1832
1832
  """
1833
1833
  Mark this parameter field as deprecated.
@@ -2141,7 +2141,7 @@ def File( # noqa: N802
2141
2141
  ),
2142
2142
  ] = None,
2143
2143
  deprecated: Annotated[
2144
- Optional[bool],
2144
+ Union[deprecated, str, bool, None],
2145
2145
  Doc(
2146
2146
  """
2147
2147
  Mark this parameter field as deprecated.
fastapi/params.py CHANGED
@@ -6,7 +6,7 @@ from fastapi.openapi.models import Example
6
6
  from pydantic.fields import FieldInfo
7
7
  from typing_extensions import Annotated, deprecated
8
8
 
9
- from ._compat import PYDANTIC_V2, Undefined
9
+ from ._compat import PYDANTIC_V2, PYDANTIC_VERSION, Undefined
10
10
 
11
11
  _Unset: Any = Undefined
12
12
 
@@ -63,12 +63,11 @@ class Param(FieldInfo):
63
63
  ),
64
64
  ] = _Unset,
65
65
  openapi_examples: Optional[Dict[str, Example]] = None,
66
- deprecated: Optional[bool] = None,
66
+ deprecated: Union[deprecated, str, bool, None] = None,
67
67
  include_in_schema: bool = True,
68
68
  json_schema_extra: Union[Dict[str, Any], None] = None,
69
69
  **extra: Any,
70
70
  ):
71
- self.deprecated = deprecated
72
71
  if example is not _Unset:
73
72
  warnings.warn(
74
73
  "`example` has been deprecated, please use `examples` instead",
@@ -106,6 +105,10 @@ class Param(FieldInfo):
106
105
  stacklevel=4,
107
106
  )
108
107
  current_json_schema_extra = json_schema_extra or extra
108
+ if PYDANTIC_VERSION < "2.7.0":
109
+ self.deprecated = deprecated
110
+ else:
111
+ kwargs["deprecated"] = deprecated
109
112
  if PYDANTIC_V2:
110
113
  kwargs.update(
111
114
  {
@@ -174,7 +177,7 @@ class Path(Param):
174
177
  ),
175
178
  ] = _Unset,
176
179
  openapi_examples: Optional[Dict[str, Example]] = None,
177
- deprecated: Optional[bool] = None,
180
+ deprecated: Union[deprecated, str, bool, None] = None,
178
181
  include_in_schema: bool = True,
179
182
  json_schema_extra: Union[Dict[str, Any], None] = None,
180
183
  **extra: Any,
@@ -260,7 +263,7 @@ class Query(Param):
260
263
  ),
261
264
  ] = _Unset,
262
265
  openapi_examples: Optional[Dict[str, Example]] = None,
263
- deprecated: Optional[bool] = None,
266
+ deprecated: Union[deprecated, str, bool, None] = None,
264
267
  include_in_schema: bool = True,
265
268
  json_schema_extra: Union[Dict[str, Any], None] = None,
266
269
  **extra: Any,
@@ -345,7 +348,7 @@ class Header(Param):
345
348
  ),
346
349
  ] = _Unset,
347
350
  openapi_examples: Optional[Dict[str, Example]] = None,
348
- deprecated: Optional[bool] = None,
351
+ deprecated: Union[deprecated, str, bool, None] = None,
349
352
  include_in_schema: bool = True,
350
353
  json_schema_extra: Union[Dict[str, Any], None] = None,
351
354
  **extra: Any,
@@ -430,7 +433,7 @@ class Cookie(Param):
430
433
  ),
431
434
  ] = _Unset,
432
435
  openapi_examples: Optional[Dict[str, Example]] = None,
433
- deprecated: Optional[bool] = None,
436
+ deprecated: Union[deprecated, str, bool, None] = None,
434
437
  include_in_schema: bool = True,
435
438
  json_schema_extra: Union[Dict[str, Any], None] = None,
436
439
  **extra: Any,
@@ -514,14 +517,13 @@ class Body(FieldInfo):
514
517
  ),
515
518
  ] = _Unset,
516
519
  openapi_examples: Optional[Dict[str, Example]] = None,
517
- deprecated: Optional[bool] = None,
520
+ deprecated: Union[deprecated, str, bool, None] = None,
518
521
  include_in_schema: bool = True,
519
522
  json_schema_extra: Union[Dict[str, Any], None] = None,
520
523
  **extra: Any,
521
524
  ):
522
525
  self.embed = embed
523
526
  self.media_type = media_type
524
- self.deprecated = deprecated
525
527
  if example is not _Unset:
526
528
  warnings.warn(
527
529
  "`example` has been deprecated, please use `examples` instead",
@@ -559,6 +561,10 @@ class Body(FieldInfo):
559
561
  stacklevel=4,
560
562
  )
561
563
  current_json_schema_extra = json_schema_extra or extra
564
+ if PYDANTIC_VERSION < "2.7.0":
565
+ self.deprecated = deprecated
566
+ else:
567
+ kwargs["deprecated"] = deprecated
562
568
  if PYDANTIC_V2:
563
569
  kwargs.update(
564
570
  {
@@ -627,7 +633,7 @@ class Form(Body):
627
633
  ),
628
634
  ] = _Unset,
629
635
  openapi_examples: Optional[Dict[str, Example]] = None,
630
- deprecated: Optional[bool] = None,
636
+ deprecated: Union[deprecated, str, bool, None] = None,
631
637
  include_in_schema: bool = True,
632
638
  json_schema_extra: Union[Dict[str, Any], None] = None,
633
639
  **extra: Any,
@@ -712,7 +718,7 @@ class File(Form):
712
718
  ),
713
719
  ] = _Unset,
714
720
  openapi_examples: Optional[Dict[str, Example]] = None,
715
- deprecated: Optional[bool] = None,
721
+ deprecated: Union[deprecated, str, bool, None] = None,
716
722
  include_in_schema: bool = True,
717
723
  json_schema_extra: Union[Dict[str, Any], None] = None,
718
724
  **extra: Any,
@@ -76,7 +76,7 @@ class APIKeyQuery(APIKeyBase):
76
76
  Doc(
77
77
  """
78
78
  By default, if the query parameter is not provided, `APIKeyQuery` will
79
- automatically cancel the request and sebd the client an error.
79
+ automatically cancel the request and send the client an error.
80
80
 
81
81
  If `auto_error` is set to `False`, when the query parameter is not
82
82
  available, instead of erroring out, the dependency result will be
fastapi/security/http.py CHANGED
@@ -15,7 +15,7 @@ from typing_extensions import Annotated, Doc
15
15
 
16
16
  class HTTPBasicCredentials(BaseModel):
17
17
  """
18
- The HTTP Basic credendials given as the result of using `HTTPBasic` in a
18
+ The HTTP Basic credentials given as the result of using `HTTPBasic` in a
19
19
  dependency.
20
20
 
21
21
  Read more about it in the
fastapi/utils.py CHANGED
@@ -221,9 +221,3 @@ def get_value_or_default(
221
221
  if not isinstance(item, DefaultPlaceholder):
222
222
  return item
223
223
  return first_item
224
-
225
-
226
- def match_pydantic_error_url(error_type: str) -> Any:
227
- from dirty_equals import IsStr
228
-
229
- return IsStr(regex=rf"^https://errors\.pydantic\.dev/.*/v/{error_type}")
@@ -1,13 +1,19 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.1
2
2
  Name: fastapi
3
- Version: 0.110.1
3
+ Version: 0.110.3.dev1
4
4
  Summary: FastAPI framework, high performance, easy to learn, fast to code, ready for production
5
- Project-URL: Homepage, https://github.com/tiangolo/fastapi
6
- Project-URL: Documentation, https://fastapi.tiangolo.com/
7
- Project-URL: Repository, https://github.com/tiangolo/fastapi
8
- Author-email: Sebastián Ramírez <tiangolo@gmail.com>
9
- License-Expression: MIT
10
- License-File: LICENSE
5
+ Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
6
+ Classifier: Intended Audience :: Information Technology
7
+ Classifier: Intended Audience :: System Administrators
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Topic :: Internet
12
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Classifier: Topic :: Software Development
16
+ Classifier: Typing :: Typed
11
17
  Classifier: Development Status :: 4 - Beta
12
18
  Classifier: Environment :: Web Environment
13
19
  Classifier: Framework :: AsyncIO
@@ -15,42 +21,42 @@ Classifier: Framework :: FastAPI
15
21
  Classifier: Framework :: Pydantic
16
22
  Classifier: Framework :: Pydantic :: 1
17
23
  Classifier: Intended Audience :: Developers
18
- Classifier: Intended Audience :: Information Technology
19
- Classifier: Intended Audience :: System Administrators
20
24
  Classifier: License :: OSI Approved :: MIT License
21
- Classifier: Operating System :: OS Independent
22
- Classifier: Programming Language :: Python
23
- Classifier: Programming Language :: Python :: 3
24
25
  Classifier: Programming Language :: Python :: 3 :: Only
25
26
  Classifier: Programming Language :: Python :: 3.8
26
27
  Classifier: Programming Language :: Python :: 3.9
27
28
  Classifier: Programming Language :: Python :: 3.10
28
29
  Classifier: Programming Language :: Python :: 3.11
29
30
  Classifier: Programming Language :: Python :: 3.12
30
- Classifier: Topic :: Internet
31
- Classifier: Topic :: Internet :: WWW/HTTP
32
31
  Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
33
- Classifier: Topic :: Software Development
34
- Classifier: Topic :: Software Development :: Libraries
35
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
36
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
37
- Classifier: Typing :: Typed
32
+ Classifier: Topic :: Internet :: WWW/HTTP
33
+ Project-URL: Homepage, https://github.com/tiangolo/fastapi
34
+ Project-URL: Documentation, https://fastapi.tiangolo.com/
35
+ Project-URL: Repository, https://github.com/tiangolo/fastapi
38
36
  Requires-Python: >=3.8
39
- Requires-Dist: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4
40
37
  Requires-Dist: starlette<0.38.0,>=0.37.2
38
+ Requires-Dist: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4
41
39
  Requires-Dist: typing-extensions>=4.8.0
40
+ Requires-Dist: httpx>=0.23.0; extra == "standard"
41
+ Requires-Dist: jinja2>=2.11.2; extra == "standard"
42
+ Requires-Dist: python-multipart>=0.0.7; extra == "standard"
43
+ Requires-Dist: email_validator>=2.0.0; extra == "standard"
44
+ Requires-Dist: uvicorn[standard]>=0.12.0; extra == "standard"
45
+ Requires-Dist: pydantic-settings>=2.0.0; extra == "standard"
46
+ Requires-Dist: pydantic-extra-types>=2.0.0; extra == "standard"
47
+ Requires-Dist: httpx>=0.23.0; extra == "all"
48
+ Requires-Dist: jinja2>=2.11.2; extra == "all"
49
+ Requires-Dist: python-multipart>=0.0.7; extra == "all"
50
+ Requires-Dist: itsdangerous>=1.1.0; extra == "all"
51
+ Requires-Dist: pyyaml>=5.3.1; extra == "all"
52
+ Requires-Dist: ujson!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,>=4.0.1; extra == "all"
53
+ Requires-Dist: orjson>=3.2.1; extra == "all"
54
+ Requires-Dist: email_validator>=2.0.0; extra == "all"
55
+ Requires-Dist: uvicorn[standard]>=0.12.0; extra == "all"
56
+ Requires-Dist: pydantic-settings>=2.0.0; extra == "all"
57
+ Requires-Dist: pydantic-extra-types>=2.0.0; extra == "all"
58
+ Provides-Extra: standard
42
59
  Provides-Extra: all
43
- Requires-Dist: email-validator>=2.0.0; extra == 'all'
44
- Requires-Dist: httpx>=0.23.0; extra == 'all'
45
- Requires-Dist: itsdangerous>=1.1.0; extra == 'all'
46
- Requires-Dist: jinja2>=2.11.2; extra == 'all'
47
- Requires-Dist: orjson>=3.2.1; extra == 'all'
48
- Requires-Dist: pydantic-extra-types>=2.0.0; extra == 'all'
49
- Requires-Dist: pydantic-settings>=2.0.0; extra == 'all'
50
- Requires-Dist: python-multipart>=0.0.7; extra == 'all'
51
- Requires-Dist: pyyaml>=5.3.1; extra == 'all'
52
- Requires-Dist: ujson!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,>=4.0.1; extra == 'all'
53
- Requires-Dist: uvicorn[standard]>=0.12.0; extra == 'all'
54
60
  Description-Content-Type: text/markdown
55
61
 
56
62
  <p align="center">
@@ -82,7 +88,7 @@ Description-Content-Type: text/markdown
82
88
 
83
89
  ---
84
90
 
85
- FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.8+ based on standard Python type hints.
91
+ FastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints.
86
92
 
87
93
  The key features are:
88
94
 
@@ -177,8 +183,6 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be
177
183
 
178
184
  ## Requirements
179
185
 
180
- Python 3.8+
181
-
182
186
  FastAPI stands on the shoulders of giants:
183
187
 
184
188
  * <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
@@ -393,7 +397,7 @@ You do that with standard modern Python types.
393
397
 
394
398
  You don't have to learn a new syntax, the methods or classes of a specific library, etc.
395
399
 
396
- Just standard **Python 3.8+**.
400
+ Just standard **Python**.
397
401
 
398
402
  For example, for an `int`:
399
403
 
@@ -518,12 +522,12 @@ Used by Starlette:
518
522
  * <a href="https://github.com/Kludex/python-multipart" target="_blank"><code>python-multipart</code></a> - Required if you want to support form <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, with `request.form()`.
519
523
  * <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.
520
524
  * <a href="https://pyyaml.org/wiki/PyYAMLDocumentation" target="_blank"><code>pyyaml</code></a> - Required for Starlette's `SchemaGenerator` support (you probably don't need it with FastAPI).
521
- * <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
522
525
 
523
526
  Used by FastAPI / Starlette:
524
527
 
525
528
  * <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
526
529
  * <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Required if you want to use `ORJSONResponse`.
530
+ * <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
527
531
 
528
532
  You can install all of these with `pip install "fastapi[all]"`.
529
533
 
@@ -1,28 +1,19 @@
1
- fastapi/__init__.py,sha256=1TIwvzs3NSS3SQGExm8yD2CgWyHOHf0zsBpPY6kf434,1081
2
- fastapi/_compat.py,sha256=i_LwkpFVbNCuraFRbc1UmNNocX63BAwjjBXgF59JJVQ,23027
1
+ fastapi-0.110.3.dev1.dist-info/METADATA,sha256=5Y8feK_iVHiThLJcCoTPrDyr30_pHDZ3K4fYl0Fdzic,25354
2
+ fastapi-0.110.3.dev1.dist-info/WHEEL,sha256=7sv5iXvIiTVJSnAxCz2tGBm9DHsb2vPSzeYeT7pvGUY,90
3
+ fastapi-0.110.3.dev1.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
4
+ fastapi/__init__.py,sha256=WT7NotdE3BUnDTe3YGPPL5S9Bip1T7TjdUPeEQZxaWY,1086
5
+ fastapi/_compat.py,sha256=OjE3FUZ0IPXqIJWKhoWKDNCHv4so-FQ-rfN8ngQZeFE,23134
3
6
  fastapi/applications.py,sha256=owRSmdslsJhJCDxxatkfMdewlaiE-9DPbwQ7alyexgU,176342
4
7
  fastapi/background.py,sha256=rouLirxUANrcYC824MSMypXL_Qb2HYg2YZqaiEqbEKI,1768
5
8
  fastapi/concurrency.py,sha256=AYLnS4judDUmXsNRICtoKSP0prfYDcS8ehBtYW9JhQQ,1403
6
9
  fastapi/datastructures.py,sha256=b2PEz77XGq-u3Ur1Inwk0AGjOsQZO49yF9C7IPJ15cY,5766
7
- fastapi/encoders.py,sha256=WHaTCzLqLl7fLW9cmdPWSmr7FGREToBrYKVHv18lfxM,10994
8
- fastapi/exception_handlers.py,sha256=MBrIOA-ugjJDivIi4rSsUJBdTsjuzN76q4yh0q1COKw,1332
9
- fastapi/exceptions.py,sha256=taNixuFEXb67lI1bnX1ubq8y8TseJ4yoPlWjyP0fTzk,4969
10
- fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54
11
- fastapi/param_functions.py,sha256=nz8maacuwRVLGjnjBD3thpn40mp8IKs0lCeKmxrbw24,63865
12
- fastapi/params.py,sha256=LzjihAvODd3w7-GddraUyVtH1xfwR9smIoQn-Z_g4mg,27807
13
- fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- fastapi/requests.py,sha256=zayepKFcienBllv3snmWI20Gk0oHNVLU4DDhqXBb4LU,142
15
- fastapi/responses.py,sha256=QNQQlwpKhQoIPZTTWkpc9d_QGeGZ_aVQPaDV3nQ8m7c,1761
16
- fastapi/routing.py,sha256=dcQBjxUsO9KT0pmp1ewJzM8qD3wjcZi1BrnyyqYELoE,174150
17
- fastapi/staticfiles.py,sha256=iirGIt3sdY2QZXd36ijs3Cj-T0FuGFda3cd90kM9Ikw,69
18
- fastapi/templating.py,sha256=4zsuTWgcjcEainMJFAlW6-gnslm6AgOS1SiiDWfmQxk,76
19
- fastapi/testclient.py,sha256=nBvaAmX66YldReJNZXPOk1sfuo2Q6hs8bOvIaCep6LQ,66
20
- fastapi/types.py,sha256=nFb36sK3DSoqoyo7Miwy3meKK5UdFBgkAgLSzQlUVyI,383
21
- fastapi/utils.py,sha256=LNep9q7ZeTQqK9-KvagV5CWn48KXwExnZGSpDsXT_Tg,8204
22
- fastapi/websockets.py,sha256=419uncYObEKZG0YcrXscfQQYLSWoE10jqxVMetGdR98,222
23
10
  fastapi/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
11
  fastapi/dependencies/models.py,sha256=-n-YCxzgVBkurQi49qOTooT71v_oeAhHJ-qQFonxh5o,2494
25
12
  fastapi/dependencies/utils.py,sha256=rynOrwW6BKSv0bTVDCY1ag4kRsOzJwmmzO31sRKsTzA,30241
13
+ fastapi/encoders.py,sha256=LvwYmFeOz4tVwvgBoC5rvZnbr7hZr73KGrU8O7zSptU,11068
14
+ fastapi/exception_handlers.py,sha256=MBrIOA-ugjJDivIi4rSsUJBdTsjuzN76q4yh0q1COKw,1332
15
+ fastapi/exceptions.py,sha256=taNixuFEXb67lI1bnX1ubq8y8TseJ4yoPlWjyP0fTzk,4969
16
+ fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54
26
17
  fastapi/middleware/__init__.py,sha256=oQDxiFVcc1fYJUOIFvphnK7pTT5kktmfL32QXpBFvvo,58
27
18
  fastapi/middleware/cors.py,sha256=ynwjWQZoc_vbhzZ3_ZXceoaSrslHFHPdoM52rXr0WUU,79
28
19
  fastapi/middleware/gzip.py,sha256=xM5PcsH8QlAimZw4VDvcmTnqQamslThsfe3CVN2voa0,79
@@ -32,16 +23,25 @@ fastapi/middleware/wsgi.py,sha256=Z3Ue-7wni4lUZMvH3G9ek__acgYdJstbnpZX_HQAboY,79
32
23
  fastapi/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
24
  fastapi/openapi/constants.py,sha256=adGzmis1L1HJRTE3kJ5fmHS_Noq6tIY6pWv_SFzoFDU,153
34
25
  fastapi/openapi/docs.py,sha256=INQd4dFFyOwckrtlrkMbWzsyI1a4wvz8c7S_u0vYgOo,10356
35
- fastapi/openapi/models.py,sha256=DEmsWA-9sNqv2H4YneZUW86r1nMwD920EiTvan5kndI,17763
36
- fastapi/openapi/utils.py,sha256=PUuz_ISarHVPBRyIgfyHz8uwH0eEsDY3rJUfW__I9GI,22303
26
+ fastapi/openapi/models.py,sha256=PqkxQiqcEgjKuhfUIWPZPQcyTcubtUCB3vcObLsB7VE,15397
27
+ fastapi/openapi/utils.py,sha256=asSbOKDuagDfpByNQvPy7OM0sqOBdUmqh64BH-n-5f0,22286
28
+ fastapi/param_functions.py,sha256=LcVyxFoK-W1gYGaH7H1dGvth1alwwxXouReg4zKSk88,64005
29
+ fastapi/params.py,sha256=GB7aNcyBt8xFUVLnLzt8AGJfZAncQJvwd4N8nhjcXHk,28191
30
+ fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ fastapi/requests.py,sha256=zayepKFcienBllv3snmWI20Gk0oHNVLU4DDhqXBb4LU,142
32
+ fastapi/responses.py,sha256=QNQQlwpKhQoIPZTTWkpc9d_QGeGZ_aVQPaDV3nQ8m7c,1761
33
+ fastapi/routing.py,sha256=dcQBjxUsO9KT0pmp1ewJzM8qD3wjcZi1BrnyyqYELoE,174150
37
34
  fastapi/security/__init__.py,sha256=bO8pNmxqVRXUjfl2mOKiVZLn0FpBQ61VUYVjmppnbJw,881
38
- fastapi/security/api_key.py,sha256=1MwaTMyqmRh0nIIDICsP6iG9Rdwbzh-BG0SFWKRc8no,9368
35
+ fastapi/security/api_key.py,sha256=_OqUUjEHG5_MT1IPAhXIGJRCPldTBdSww_DegFy_W8Y,9368
39
36
  fastapi/security/base.py,sha256=dl4pvbC-RxjfbWgPtCWd8MVU-7CB2SZ22rJDXVCXO6c,141
40
- fastapi/security/http.py,sha256=Cb7DbOPWpnzvKZTwCdxWRXxa2txZBdeeAdT0tlRdQgY,13506
37
+ fastapi/security/http.py,sha256=sXw3jvaMPxDmMaGlf5e2ES5TuGXDKXFOigntzUfSqIg,13506
41
38
  fastapi/security/oauth2.py,sha256=lWemX4CLAvanR6-jiQxFtOyHjHbzEnNbpytA_WXgZcw,21583
42
39
  fastapi/security/open_id_connect_url.py,sha256=8vizZ2tGqEp1ur8SwtVgyHJhGAJ5AqahgcvSpaIioDI,2722
43
40
  fastapi/security/utils.py,sha256=bd8T0YM7UQD5ATKucr1bNtAvz_Y3__dVNAv5UebiPvc,293
44
- fastapi-0.110.1.dist-info/METADATA,sha256=aOPlukMP9l1KQLsvqnZN053v4lVrFxjNnKvDKTJ_Rtk,24966
45
- fastapi-0.110.1.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
46
- fastapi-0.110.1.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
47
- fastapi-0.110.1.dist-info/RECORD,,
41
+ fastapi/staticfiles.py,sha256=iirGIt3sdY2QZXd36ijs3Cj-T0FuGFda3cd90kM9Ikw,69
42
+ fastapi/templating.py,sha256=4zsuTWgcjcEainMJFAlW6-gnslm6AgOS1SiiDWfmQxk,76
43
+ fastapi/testclient.py,sha256=nBvaAmX66YldReJNZXPOk1sfuo2Q6hs8bOvIaCep6LQ,66
44
+ fastapi/types.py,sha256=nFb36sK3DSoqoyo7Miwy3meKK5UdFBgkAgLSzQlUVyI,383
45
+ fastapi/utils.py,sha256=lHKngr-TmOx9QzSyA6PXYSvEgxPYUIk5t3u-kZtskEM,8035
46
+ fastapi/websockets.py,sha256=419uncYObEKZG0YcrXscfQQYLSWoE10jqxVMetGdR98,222
47
+ fastapi-0.110.3.dev1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.22.4
2
+ Generator: pdm-backend (2.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any