Skip to content

Conversation

@JC-wk
Copy link
Collaborator

@JC-wk JC-wk commented Dec 24, 2025

Resolves #4797

What is being addressed

Dependencies are duplicated which would cause auth checks to run twice

If you attach the same auth dependency both at the router level (via APIRouter(dependencies=[Depends(auth)])) and again on the endpoint (either in dependencies=[Depends(auth)] or as a parameter user = Depends(auth)), FastAPI will execute it twice because each Depends(...) occurrence is evaluated independently; router-level dependencies are simply added to the route’s dependency list. [fastapi.tiangolo.com]

How is this addressed

  • Remove dependencies where they are the same as the router dependencies
  • Updated CHANGELOG.md if needed
  • Increment API version

@JC-wk JC-wk requested a review from a team as a code owner December 24, 2025 14:24
@JC-wk JC-wk changed the title remove duplicate depends in API remove duplicate dependencies in API Dec 24, 2025
@github-actions
Copy link

github-actions bot commented Dec 24, 2025

Unit Test Results

664 tests   664 ✅  7s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit ea1adb6.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependencies are duplicated which could cause auth checks to run twice within the API

1 participant