Skip to content

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
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