mirror of https://github.com/tiangolo/fastapi.git
Merge 45c564895f into 272204c0c7
This commit is contained in:
commit
ad6c794acd
|
|
@ -621,22 +621,17 @@ async def solve_dependencies(
|
||||||
response.status_code = None # type: ignore
|
response.status_code = None # type: ignore
|
||||||
if dependency_cache is None:
|
if dependency_cache is None:
|
||||||
dependency_cache = {}
|
dependency_cache = {}
|
||||||
|
dependency_overrides: Dict[Callable[..., Any], Callable[..., Any]] = getattr(
|
||||||
|
dependency_overrides_provider, "dependency_overrides", {}
|
||||||
|
)
|
||||||
for sub_dependant in dependant.dependencies:
|
for sub_dependant in dependant.dependencies:
|
||||||
sub_dependant.call = cast(Callable[..., Any], sub_dependant.call)
|
call = cast(Callable[..., Any], sub_dependant.call)
|
||||||
call = sub_dependant.call
|
|
||||||
use_sub_dependant = sub_dependant
|
use_sub_dependant = sub_dependant
|
||||||
if (
|
if dependency_overrides and (overridden_call := dependency_overrides.get(call)):
|
||||||
dependency_overrides_provider
|
call = overridden_call
|
||||||
and dependency_overrides_provider.dependency_overrides
|
|
||||||
):
|
|
||||||
original_call = sub_dependant.call
|
|
||||||
call = getattr(
|
|
||||||
dependency_overrides_provider, "dependency_overrides", {}
|
|
||||||
).get(original_call, original_call)
|
|
||||||
use_path: str = sub_dependant.path # type: ignore
|
|
||||||
use_sub_dependant = get_dependant(
|
use_sub_dependant = get_dependant(
|
||||||
path=use_path,
|
path=cast(str, sub_dependant.path),
|
||||||
call=call,
|
call=overridden_call,
|
||||||
name=sub_dependant.name,
|
name=sub_dependant.name,
|
||||||
parent_oauth_scopes=sub_dependant.oauth_scopes,
|
parent_oauth_scopes=sub_dependant.oauth_scopes,
|
||||||
scope=sub_dependant.scope,
|
scope=sub_dependant.scope,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue