Skip to content

Unable to inject annotated types with inject attribute #267

Open
@sergey-zinchenko

Description

@sergey-zinchenko

I tried to inject annotated type into the class via the @inject decorator, and the injector injected the default value for the annotated source class. The injector always extracts the source class from the annotated and replaces the original attributed type with the extracted one in the bindings map. So when you use Annotated[str, "foo"] and try to @inject it into some class, the constructor will receive an empty string instead of the provider you set while configuring the binder.

I prepared the PR with the possible fix and the test describing the issue
PR 266

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