Skip to content

Commit

Permalink
fix: respect default with custom (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik authored Jul 11, 2024
1 parent bebf62d commit c190b28
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion fast_depends/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""FastDepends - extracted and cleared from HTTP domain FastAPI Dependency Injection System"""

__version__ = "2.4.4"
__version__ = "2.4.5"
5 changes: 4 additions & 1 deletion fast_depends/core/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
-r requirements.test.txt

mypy >=1.8.0
ruff ==0.4.8
ruff ==0.5.1
codespell ==2.3.0

0 comments on commit c190b28

Please sign in to comment.