From c190b28ce8eba74343ac81809900feb5ad2101e9 Mon Sep 17 00:00:00 2001 From: Pastukhov Nikita Date: Thu, 11 Jul 2024 13:44:42 +0300 Subject: [PATCH] fix: respect default with custom (#111) --- .github/workflows/publish_coverage.yml | 2 +- .github/workflows/publish_pypi.yml | 2 +- fast_depends/__about__.py | 2 +- fast_depends/core/build.py | 5 ++++- requirements.dev.txt | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish_coverage.yml b/.github/workflows/publish_coverage.yml index 2e610d0..d77ac8e 100644 --- a/.github/workflows/publish_coverage.yml +++ b/.github/workflows/publish_coverage.yml @@ -20,7 +20,7 @@ jobs: - run: pip install smokeshow - - uses: dawidd6/action-download-artifact@v5 + - uses: dawidd6/action-download-artifact@v6 with: workflow: tests.yml commit: ${{ github.event.workflow_run.head_sha }} diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index dcdff35..484cddb 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -39,7 +39,7 @@ jobs: run: python -m build - name: Publish - uses: pypa/gh-action-pypi-publish@v1.8.14 + uses: pypa/gh-action-pypi-publish@v1.9.0 with: password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/fast_depends/__about__.py b/fast_depends/__about__.py index 3e9462e..1064c1f 100644 --- a/fast_depends/__about__.py +++ b/fast_depends/__about__.py @@ -1,3 +1,3 @@ """FastDepends - extracted and cleared from HTTP domain FastAPI Dependency Injection System""" -__version__ = "2.4.4" +__version__ = "2.4.5" diff --git a/fast_depends/core/build.py b/fast_depends/core/build.py index 6cd5e37..8d6b9a7 100644 --- a/fast_depends/core/build.py +++ b/fast_depends/core/build.py @@ -148,6 +148,7 @@ def build_call_model( if dep.cast is True: class_fields[param_name] = (annotation, ...) + keyword_args.append(param_name) elif custom: @@ -163,8 +164,10 @@ def build_call_model( if custom.required: class_fields[param_name] = (annotation, ...) + else: - class_fields[param_name] = (Optional[annotation], None) + class_fields[param_name] = class_fields.get(param_name, (Optional[annotation], None)) + keyword_args.append(param_name) else: diff --git a/requirements.dev.txt b/requirements.dev.txt index 8a6f8d7..deb09b2 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -4,5 +4,5 @@ -r requirements.test.txt mypy >=1.8.0 -ruff ==0.4.8 +ruff ==0.5.1 codespell ==2.3.0 \ No newline at end of file