Browse Source

️ Stop retaining flat dependency trees (#16065)

Co-authored-by: Marcelo Trylesinski <[email protected]>
pull/16066/head
Sebastián Ramírez 2 days ago
committed by GitHub
parent
commit
8069eadf5e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      fastapi/routing.py

13
fastapi/routing.py

@ -807,7 +807,7 @@ class APIWebSocketRoute(routing.WebSocketRoute):
self.path_regex, self.path_format, self.param_convertors = compile_path(path)
(
self.dependant,
self._flat_dependant,
_,
self._embed_body_fields,
) = _build_dependant_with_parameterless_dependencies(
path=self.path_format,
@ -944,7 +944,6 @@ class _APIRouteLike(Protocol):
description: str
response_fields: dict[int | str, ModelField]
dependant: Dependant
_flat_dependant: Dependant
_embed_body_fields: bool
body_field: ModelField | None
is_sse_stream: bool
@ -1091,7 +1090,7 @@ def _populate_api_route_state(
assert callable(endpoint), "An endpoint must be a callable"
(
route.dependant,
route._flat_dependant,
flat_dependant,
route._embed_body_fields,
) = _build_dependant_with_parameterless_dependencies(
path=route.path_format,
@ -1099,7 +1098,7 @@ def _populate_api_route_state(
dependencies=route.dependencies,
)
route.body_field = get_body_field(
flat_dependant=route._flat_dependant,
flat_dependant=flat_dependant,
name=route.unique_id,
embed_body_fields=route._embed_body_fields,
)
@ -1145,7 +1144,6 @@ class APIRoute(routing.Route):
description: str
response_fields: dict[int | str, ModelField]
dependant: Dependant
_flat_dependant: Dependant
_embed_body_fields: bool
body_field: ModelField | None
is_sse_stream: bool
@ -1410,7 +1408,6 @@ class _EffectiveRouteContext:
description: str = ""
response_fields: dict[int | str, ModelField] = field(default_factory=dict)
dependant: Dependant | None = None
_flat_dependant: Dependant | None = None
_embed_body_fields: bool = False
body_field: ModelField | None = None
is_sse_stream: bool = False
@ -1486,7 +1483,7 @@ class _EffectiveRouteContext:
)
(
context.dependant,
context._flat_dependant,
_,
context._embed_body_fields,
) = _build_dependant_with_parameterless_dependencies(
path="",
@ -2080,7 +2077,7 @@ class _FrontendRouteGroup(BaseRoute):
self.dependency_overrides_provider = dependency_overrides_provider
(
self.dependant,
self._flat_dependant,
_,
self._embed_body_fields,
) = _build_dependant_with_parameterless_dependencies(
path="",

Loading…
Cancel
Save