Prevent FastAPI from digging into real dependencies attributes detecting them as request data.
You can install fastapi-depends-stub from PyPI:
python -m pip install fastapi-depends-stub
When declaring your dependency, instead of:
interactor: Annotated[Interactor, Depends()]
You should write:
interactor: Annotated[Interactor, Depends(Stub(Interactor))]
And don't forget to declare how to create your dependency:
app.dependency_overrides[Interactor] = some_real_factory()
I believe that there is nothing you can do anymore with this package, but if you have some ideas - you're always welcome!
All credits go to Tishka17, I've just packed his Stub implementation.