fastapi 0.112.4__py3-none-any.whl → 0.113.0__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.112.4"
3
+ __version__ = "0.113.0"
4
4
 
5
5
  from starlette import status as status
6
6
 
@@ -33,6 +33,7 @@ from fastapi._compat import (
33
33
  field_annotation_is_scalar,
34
34
  get_annotation_from_field_info,
35
35
  get_missing_field_error,
36
+ get_model_fields,
36
37
  is_bytes_field,
37
38
  is_bytes_sequence_field,
38
39
  is_scalar_field,
@@ -56,6 +57,7 @@ from fastapi.security.base import SecurityBase
56
57
  from fastapi.security.oauth2 import OAuth2, SecurityScopes
57
58
  from fastapi.security.open_id_connect_url import OpenIdConnect
58
59
  from fastapi.utils import create_model_field, get_path_param_names
60
+ from pydantic import BaseModel
59
61
  from pydantic.fields import FieldInfo
60
62
  from starlette.background import BackgroundTasks as StarletteBackgroundTasks
61
63
  from starlette.concurrency import run_in_threadpool
@@ -743,7 +745,9 @@ def _should_embed_body_fields(fields: List[ModelField]) -> bool:
743
745
  return True
744
746
  # If it's a Form (or File) field, it has to be a BaseModel to be top level
745
747
  # otherwise it has to be embedded, so that the key value pair can be extracted
746
- if isinstance(first_field.field_info, params.Form):
748
+ if isinstance(first_field.field_info, params.Form) and not lenient_issubclass(
749
+ first_field.type_, BaseModel
750
+ ):
747
751
  return True
748
752
  return False
749
753
 
@@ -783,7 +787,8 @@ async def _extract_form_body(
783
787
  for sub_value in value:
784
788
  tg.start_soon(process_fn, sub_value.read)
785
789
  value = serialize_sequence_value(field=field, value=results)
786
- values[field.name] = value
790
+ if value is not None:
791
+ values[field.name] = value
787
792
  return values
788
793
 
789
794
 
@@ -798,8 +803,14 @@ async def request_body_to_args(
798
803
  single_not_embedded_field = len(body_fields) == 1 and not embed_body_fields
799
804
  first_field = body_fields[0]
800
805
  body_to_process = received_body
806
+
807
+ fields_to_extract: List[ModelField] = body_fields
808
+
809
+ if single_not_embedded_field and lenient_issubclass(first_field.type_, BaseModel):
810
+ fields_to_extract = get_model_fields(first_field.type_)
811
+
801
812
  if isinstance(received_body, FormData):
802
- body_to_process = await _extract_form_body(body_fields, received_body)
813
+ body_to_process = await _extract_form_body(fields_to_extract, received_body)
803
814
 
804
815
  if single_not_embedded_field:
805
816
  loc: Tuple[str, ...] = ("body",)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastapi
3
- Version: 0.112.4
3
+ Version: 0.113.0
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
@@ -115,7 +115,7 @@ The key features are:
115
115
  <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>
116
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>
117
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>
118
- <a href="https://docs.withcoherence.com/coherence-templates/full-stack-template/#fastapi?utm_medium=advertising&utm_source=fastapi&utm_campaign=docs" target="_blank" title="Coherence"><img src="https://fastapi.tiangolo.com/img/sponsors/coherence.png"></a>
118
+ <a href="https://www.withcoherence.com/?utm_medium=advertising&utm_source=fastapi&utm_campaign=website" target="_blank" title="Coherence"><img src="https://fastapi.tiangolo.com/img/sponsors/coherence.png"></a>
119
119
  <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>
120
120
  <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>
121
121
  <a href="https://fine.dev?ref=fastapibadge" target="_blank" title="Fine's AI FastAPI Workflow: Effortlessly Deploy and Integrate FastAPI into Your Project"><img src="https://fastapi.tiangolo.com/img/sponsors/fine.png"></a>
@@ -1,8 +1,8 @@
1
- fastapi-0.112.4.dist-info/METADATA,sha256=5HI7E6Ktp7E6DHqe-EAOrbdi9cOuiJqLfxqBCeJGmcQ,27273
2
- fastapi-0.112.4.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
3
- fastapi-0.112.4.dist-info/entry_points.txt,sha256=Nn2-rs4A5_lQZko2b9QqCKQx9Irx0agGbxq3QLgjBxQ,46
4
- fastapi-0.112.4.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
5
- fastapi/__init__.py,sha256=6SxOneGIhP_aHxYYRO2T6iyZXYjC_rjss7xd3XsWl7s,1081
1
+ fastapi-0.113.0.dist-info/METADATA,sha256=ii9Gxjj0MqtirULJzkuNcZ6ur3w-NRAvUA1Z0dv_EOY,27227
2
+ fastapi-0.113.0.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
3
+ fastapi-0.113.0.dist-info/entry_points.txt,sha256=Nn2-rs4A5_lQZko2b9QqCKQx9Irx0agGbxq3QLgjBxQ,46
4
+ fastapi-0.113.0.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
5
+ fastapi/__init__.py,sha256=d4A3W-W3uWnnSbn4daxNgwAvbz-XdCxNGIoAU2Xh68w,1081
6
6
  fastapi/__main__.py,sha256=bKePXLdO4SsVSM6r9SVoLickJDcR2c0cTOxZRKq26YQ,37
7
7
  fastapi/_compat.py,sha256=9AipVKxefipp4ymECk3VhrryBi-Hbh8A7zsljaWdGAk,23723
8
8
  fastapi/applications.py,sha256=Ix-o9pQAWhEDf9J0Q1hZ0nBB1uP72c-Y3oiYzvrwqiM,176316
@@ -12,7 +12,7 @@ fastapi/concurrency.py,sha256=AYLnS4judDUmXsNRICtoKSP0prfYDcS8ehBtYW9JhQQ,1403
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=k3bs2iNotFYcwO_RihkdJjGrBAr2SNOxf6j5u7vu9gM,31980
15
+ fastapi/dependencies/utils.py,sha256=EGlTiaoExyqTVLYEuQnHa8NDfuf37YNRs-gU2hiwlxo,32352
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
@@ -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.112.4.dist-info/RECORD,,
50
+ fastapi-0.113.0.dist-info/RECORD,,