A utility library for FastAPI that lets you create decorators for endpoints using FastAPI's dependency injection. It provides a @depends decorator that wraps dependencies and preserves type hints, making it easy to reuse common preprocessing logic. Current version: 1.0.20. Released intermittently, with bugfix and compatibility improvements.
pip install fastapi-decoratorsVerified import paths — ran on the pinned version, not inferred.
Create a reusable dependency decorator that extracts a token, then apply it to an endpoint. The dependency is injected as a parameter.
Always include the dependency as a parameter in the endpoint function with Depends() if you need to access its return value; otherwise, the return value is lost.
Upgrade to 1.0.20 or later, or omit explicit `-> None` from dependency functions.
Upgrade to 1.0.16 or later, or avoid forward reference annotations in dependency functions.
Ensure you have fastapi-decorators >=1.0.0 installed. Use `from fastapi_decorators import depends`.
Use `from fastapi_decorators import depends` and apply it as a decorator: `@depends(some_dependency)`.
Upgrade to fastapi-decorators >=1.0.16. If that's not possible, replace string annotations with actual type references.