Problem
The API layer uses the legacy param: Type = Depends() pattern for dependency injection. SonarCloud flags 52 blocker-level code smells for this across the API layer.
The modern FastAPI pattern (since v0.95+) uses Annotated:
# Old pattern
async def endpoint(service: MyService = Depends()):
# New pattern
from typing import Annotated
async def endpoint(service: Annotated[MyService, Depends()]):
Affected Files
app/api/audio_api.py — 12 instances
app/api/audio_services_api.py — 20 instances
app/api/task_api.py — 3 instances
app/api/dependencies.py — dependency provider definitions
Tasks
Acceptance Criteria
- All
Depends() calls in API endpoints use Annotated[] pattern
- SonarCloud blocker code smells resolved
- All tests pass, coverage maintained >=80%
Problem
The API layer uses the legacy
param: Type = Depends()pattern for dependency injection. SonarCloud flags 52 blocker-level code smells for this across the API layer.The modern FastAPI pattern (since v0.95+) uses
Annotated:Affected Files
app/api/audio_api.py— 12 instancesapp/api/audio_services_api.py— 20 instancesapp/api/task_api.py— 3 instancesapp/api/dependencies.py— dependency provider definitionsTasks
app/api/dependencies.py(e.g.,AudioService = Annotated[AudioService, Depends(get_audio_service)])audio_api.pyendpoints to useAnnotated[]audio_services_api.pyendpoints to useAnnotated[]task_api.pyendpoints to useAnnotated[]task check && task testto verify no regressionsAcceptance Criteria
Depends()calls in API endpoints useAnnotated[]pattern