diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 3cbecc04..f62d8b01 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -7,6 +7,12 @@ that were made in every particular version. From version 0.7.6 *Dependency Injector* framework strictly follows `Semantic versioning`_ +4.5.2 +----- +- Fix a bug in wiring ``@inject`` with not properly working ``FastAPI.Depends`` directive. + See issue `#330 `_ for details. + Thanks to `Lojka-oops `_ for reporting the issue. + 4.5.1 ----- - Fix flake8 issue in ``Commands and Handlers`` example. diff --git a/src/dependency_injector/__init__.py b/src/dependency_injector/__init__.py index a48eb83f..b6c44fab 100644 --- a/src/dependency_injector/__init__.py +++ b/src/dependency_injector/__init__.py @@ -1,6 +1,6 @@ """Top-level package.""" -__version__ = '4.5.1' +__version__ = '4.5.2' """Version number. :type: str diff --git a/src/dependency_injector/wiring.py b/src/dependency_injector/wiring.py index 6752f106..d686d66f 100644 --- a/src/dependency_injector/wiring.py +++ b/src/dependency_injector/wiring.py @@ -336,6 +336,9 @@ def _fetch_reference_injections( if _is_fastapi_depends(marker): marker = marker.dependency + if not isinstance(marker, providers.Provider): + continue + if isinstance(marker, Closing): marker = marker.provider closing[parameter_name] = marker