BlackSheep icon indicating copy to clipboard operation
BlackSheep copied to clipboard

Error using 3rd party dependency injector

Open rocinant3 opened this issue 1 year ago • 1 comments

Library: dependency_injector (wriring) Error: TypeError: my_router() got multiple values for argument 'service' Code:

from deps import Deps, ProfileService
from dependency_injector.wiring import Provide, inject
from blacksheep import Application


app = Application()


@app.router.get("/")
@inject
async def my_router(service: ProfileService = Provide[Deps.profile_service]):
    return {"ok": True}


@app.on_start
async def on_start(_):
    print("start")
    Deps().wire(packages=[__name__])

Can this be fixed somehow?

rocinant3 avatar Aug 15 '23 19:08 rocinant3