Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.PHONY: lint lint-fix test test-cov test-all install-githooks
.PHONY: lint lint-fix test test-cov test-all install-githooks install-dependencies

install-dependencies:
uv sync --all-groups --all-extras

install-githooks:
@cd .git/hooks; \
Expand Down
3 changes: 1 addition & 2 deletions fastapi_depends_anywhere/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Any, overload

from fastapi import FastAPI
from fastapi._compat import _normalize_errors
from fastapi.dependencies.utils import solve_dependencies
from fastapi.exceptions import RequestValidationError
from starlette.requests import Request
Expand Down Expand Up @@ -82,7 +81,7 @@ async def my_function(db: Database = Depends(get_db)) -> None:
embed_body_fields=False,
)
if solved_result.errors:
raise RequestValidationError(_normalize_errors(solved_result.errors))
raise RequestValidationError(solved_result.errors)

yield solved_result.values

Expand Down
19 changes: 11 additions & 8 deletions fastapi_depends_anywhere/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from __future__ import annotations

from collections.abc import Awaitable, Callable
from typing import TYPE_CHECKING, overload
from typing import TYPE_CHECKING, cast, overload

from fastapi_depends_anywhere.config import get_app
from fastapi_depends_anywhere.core import with_fastapi_depends
Expand Down Expand Up @@ -95,14 +95,17 @@ def decorator(fn: Callable[..., Awaitable[R]]) -> Callable[..., R]:
)
raise RuntimeError(msg)

return runnify(
with_fastapi_lifecycle(
with_fastapi_depends(
fn,
return cast(
"Callable[..., R]",
runnify(
with_fastapi_lifecycle(
with_fastapi_depends(
fn,
app=resolved_app,
),
app=resolved_app,
),
app=resolved_app,
)
)
),
)

if func is not None:
Expand Down
Loading
Loading