You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now this doesn't work too, because of python/mypy#3135. Mypy doesn't work with class decorators out of the box.
They will need to write their own plugin to hook onto the decorator name.
Proposal A
In our mypy plugin, we check if it is a pydantic conversion parameter through a whitelist in _is_strawberry_pydantic_decorator.
We can allow more functions to be added through this whitelist.
We can have a specifc keyword that the class decorator will hook on. e.g. strawberry_pydantic
Users can't easily define their own pydantic conversion decorators with their desired defaults or values.
It wouldn't be mypy compatible.
First, partial functions don't work in mypy
The second alternative is to manually define it out
Now this doesn't work too, because of python/mypy#3135. Mypy doesn't work with class decorators out of the box.
They will need to write their own plugin to hook onto the decorator name.
Proposal A
In our mypy plugin, we check if it is a pydantic conversion parameter through a whitelist in
_is_strawberry_pydantic_decorator
.We can allow more functions to be added through this whitelist.
We can have a specifc keyword that the class decorator will hook on. e.g.
strawberry_pydantic
This way the user can define
and our mypy plugin will hook onto it.
This workaround is quite hacky.
Proposal B
We can add a setting for our mypy plugin which allows users to specify the decorator names.
We'll hook onto those
Looking for other suggestions. @patrick91
Upvote & Fund
The text was updated successfully, but these errors were encountered: