Skip to main content

get_dependant

Analyzes a callable to build a Dependant object by recursively resolving its parameters, dependencies, and security scopes. It validates parameter types against the provided path and signature, raising a DependencyScopeError if scope mismatches are detected.

def get_dependant(
path: str,
call: Callable[..., Any],
name: str | None = None,
own_oauth_scopes: list[str] | None = None,
parent_oauth_scopes: list[str] | None = None,
use_cache: bool = True,
scope: Literal['function', 'request'] | None = None
) - > Dependant

Parses a callable and its signature to build a recursive dependency model used for dependency injection and request validation. It analyzes function parameters to categorize them as path, body, or sub-dependency components while validating OAuth2 scopes and dependency lifecycles.

Parameters

NameTypeDescription
pathstrThe URL path template used to identify and validate path parameters within the callable's signature.
callCallable[..., Any]The function or callable object to be analyzed for dependency injection.
name`strNone` = None
own_oauth_scopes`list[str]None` = None
parent_oauth_scopes`list[str]None` = None
use_cachebool = TrueDetermines whether the result of this dependency should be cached and reused within the same request.
scope`Literal['function', 'request']None` = None

Returns

TypeDescription
DependantA structured object containing the metadata, parameters, and nested sub-dependencies required to execute the provided callable.