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

strawberry.ext.mypy_plugin Pydantic 2.9.0 PydanticModelField.to_argument error missing 'model_strict' and 'is_root_model_root' #3631

Open
victor-nb opened this issue Sep 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@victor-nb
Copy link

victor-nb commented Sep 13, 2024

Hello!

It seems the Pydantic 2.9.0 version introduced a breaking change on PydanticModelField.to_argument adding two new arguments:

pydantic/pydantic@d6df62a
and
pydantic/pydantic@93ced97

Describe the Bug

This is the mypy trace

./my-file.py:132: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.11.2
Traceback (most recent call last):
  File "mypy/semanal.py", line 7087, in accept
  File "mypy/nodes.py", line 1183, in accept
  File "mypy/semanal.py", line 1700, in visit_class_def
  File "mypy/semanal.py", line 1891, in analyze_class
  File "mypy/semanal.py", line 1925, in analyze_class_body_common
  File "mypy/semanal.py", line 1996, in apply_class_plugin_hooks
  File "/Users/victorbarroncas/code/boostsec-asset-management/.venv/lib/python3.12/site-packages/strawberry/ext/mypy_plugin.py", line 489, in strawberry_pydantic_class_callback
    f.to_argument(
TypeError: PydanticModelField.to_argument() missing 2 required positional arguments: 'model_strict' and 'is_root_model_root'
./my-file.py:132: : note: use --pdb to drop into pdb

System Information

  • Operating system: OSX
  • strawberry-graphql 0.240.3
  • pydantic 2.9.1
  • pydantic-core 2.23.3
  • mypy 1.11.2
  • mypy-extensions 1.0.0

Additional Context

Similar issue:
#3560

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@victor-nb victor-nb added the bug Something isn't working label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant