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: pydantic ^2.9.0 needs 2 extra fields on to_argument #3632

Merged
merged 6 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion strawberry/ext/mypy_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
# Based on pydantic's default value
# https://github.com/pydantic/pydantic/pull/9606/files#diff-469037bbe55bbf9aa359480a16040d368c676adad736e133fb07e5e20d6ac523R1066
extra["force_typevars_invariant"] = False

if PYDANTIC_VERSION >= (2, 9, 0):
patrick91 marked this conversation as resolved.
Show resolved Hide resolved
extra["model_strict"] = model_type.type.metadata[PYDANTIC_METADATA_KEY]["config"].get("strict", False)
chrisemke marked this conversation as resolved.
Show resolved Hide resolved
extra["is_root_model_root"] = any("pydantic.root_model.RootModel" in base.fullname for base in model_type.type.mro[:-1])
add_method(
ctx,
"to_pydantic",
Expand Down
Loading