Skip to content

Commit

Permalink
fix: pydantic ^2.9.0 needs 2 extra fields on to_argument
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisemke committed Sep 14, 2024
1 parent 2d96d23 commit 3f13e0a
Showing 1 changed file with 3 additions and 1 deletion.
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):
extra["model_strict"] = model_type.type.metadata[PYDANTIC_METADATA_KEY]["config"].get("strict", False)
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

0 comments on commit 3f13e0a

Please sign in to comment.