Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow to use */** arguments with non-standard names #127

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

Zhenay
Copy link
Contributor

@Zhenay Zhenay commented Aug 27, 2024

Right now it is only allowed to use astersisk arguments only if they are named as args and kwargs:

@inject
def some_func(**kwargs):  # works
    ...

@inject
def another_func(**context):  # fails
    ...

If you try to use another name in such a context, you will get the ValidationError like this:

ValidationError: 1 validation error for some_func
context
  Field required [type=missing]
    For further information visit https://errors.pydantic.dev/2.8/v/missing

This applies to both *args and **kwargs arguments with custom names. This pull request is to fix this behaviour

Copy link
Owner

@Lancetnik Lancetnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! I wanted to fix it long time ago, but had no time 😢

@Lancetnik Lancetnik merged commit b07d46d into Lancetnik:main Aug 27, 2024
13 checks passed
Lancetnik added a commit that referenced this pull request Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants