Skip to content

Commit 161ba0e

Browse files
author
Rami Chowdhury
committed
Unwrap types before recursing
1 parent a162db6 commit 161ba0e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

graphene_pydantic/converters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ def convert_generic_type(type_, field, registry=None):
158158
elif origin in (T.List, T.Set, T.Collection, T.Iterable, list, set) or issubclass(
159159
origin, Sequence
160160
):
161-
return List(to_graphene_type(type_, field, registry))
161+
wrapped_types = getattr(type_, "__args__", [])
162+
if not wrapped_types:
163+
raise ConversionError(
164+
f"Don't know how to handle {type_} (generic: {origin})"
165+
)
166+
return List(to_graphene_type(wrapped_types[0], field, registry))
162167
else:
163168
raise ConversionError(f"Don't know how to handle {type_} (generic: {origin})")
164169

0 commit comments

Comments
 (0)