INNER CODE UNIT · Python
resolve_dependencies
JasperSui/fastapi-injectable · src/fastapi_injectable/main.py:126
async def resolve_dependencies(
func: Callable[P, T] | Callable[P, Awaitable[T]],
*,
use_cache: bool = True,
provided_kwargs: dict[str, Any] | None = None,
) -> dict[str, Any]:
"""Resolve dependencies for the given function using FastAPI's dependency injection system.
This function resolves dependencies defined via FastAPI's dependency mechanism
and returns a dictionary of resolved arguments for the given function.
Args:
func: The function for which dependencies need to be resolved. It can be a synchronous
or asynchronous callable.
use_cache: Whether to use a cache for dependency resolution. Defaults to True.
provided_kwargs: Explicit kwargs passed by the caller (these override DI).
Returns: