Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b59133c

Browse filesBrowse files
committed
fix: optional union type errors
1 parent d18a010 commit b59133c
Copy full SHA for b59133c

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎graphene_pydantic/converters.py

Copy file name to clipboardExpand all lines: graphene_pydantic/converters.py
+3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.