Skip to content

Commit b59133c

Browse files
committed
fix: optional union type errors
1 parent d18a010 commit b59133c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

graphene_pydantic/converters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def convert_pydantic_field(
9797
to the generated Graphene data model type.
9898
"""
9999
declared_type = getattr(field, "annotation", None)
100+
# Convert Python 11 UnionType to T.Union
101+
if isinstance(declared_type, UnionType):
102+
declared_type = T.Union[declared_type.__args__]
100103
field_kwargs.setdefault(
101104
"type" if GRAPHENE2 else "type_",
102105
convert_pydantic_type(

0 commit comments

Comments
 (0)