diff --git a/strawberry/annotation.py b/strawberry/annotation.py index 8cac2baf96..440f0a5bd9 100644 --- a/strawberry/annotation.py +++ b/strawberry/annotation.py @@ -129,6 +129,8 @@ def resolve(self) -> Union[StrawberryType, type]: evaled_type = self._strip_async_type(evaled_type) if self._is_lazy_type(evaled_type): return evaled_type + if self._is_list(evaled_type): + return self.create_list(evaled_type) if self._is_generic(evaled_type): if any(is_type_var(type_) for type_ in get_args(evaled_type)): @@ -139,8 +141,6 @@ def resolve(self) -> Union[StrawberryType, type]: # a StrawberryType if self._is_enum(evaled_type): return self.create_enum(evaled_type) - if self._is_list(evaled_type): - return self.create_list(evaled_type) elif self._is_optional(evaled_type, args): return self.create_optional(evaled_type) elif self._is_union(evaled_type, args): @@ -286,8 +286,14 @@ def _is_list(cls, annotation: Any) -> bool: """Returns True if annotation is a List""" annotation_origin = get_origin(annotation) + annotation_mro = getattr(annotation, "__mro__", []) + is_list = any(x is list for x in annotation_mro) - return (annotation_origin in (list, tuple)) or annotation_origin is abc.Sequence + return ( + (annotation_origin in (list, tuple)) + or annotation_origin is abc.Sequence + or is_list + ) @classmethod def _is_strawberry_type(cls, evaled_type: Any) -> bool: