Skip to content

Migration guide from dependency_injector #60

Description

@JobaDiniz
  1. It's written that this lib does not have wiring. What's the alternative and why it does not matter? What do I need to change?
  2. I'm using dead dependency_injector for fastapi. Does that-depends support passing the request: Request into the dependency?

https://that-depends.readthedocs.io/introduction/fastapi.html

@app.get("/")
async def read_root(
    some_dependency: typing.Annotated[
        container.DependentFactory,
        fastapi.Depends(container.DIContainer.dependent_factory),
    ],
) -> datetime.datetime:
    return some_dependency.async_resource

In the above example, I need that the instance of dependent_factory to have access to the request object of fastapi. How can this be implemented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions