From 5a12b9cb979c3b00ddea5f71978c2534550b66cb Mon Sep 17 00:00:00 2001 From: Alec Rosenbaum Date: Tue, 23 Nov 2021 21:35:48 +0000 Subject: [PATCH] fix type checking on is_type_of --- strawberry/experimental/pydantic/object_type.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/strawberry/experimental/pydantic/object_type.py b/strawberry/experimental/pydantic/object_type.py index fbdf6e5f98..e1dc3ff75e 100644 --- a/strawberry/experimental/pydantic/object_type.py +++ b/strawberry/experimental/pydantic/object_type.py @@ -7,6 +7,8 @@ from pydantic import BaseModel from pydantic.fields import ModelField +from graphql import GraphQLResolveInfo + import strawberry from strawberry.arguments import UNSET from strawberry.experimental.pydantic.conversion import ( @@ -149,8 +151,8 @@ def wrap(cls): # Implicitly define `is_type_of` to support interfaces/unions that use # pydantic objects (not the corresponding strawberry type) - @classmethod - def is_type_of(cls, obj, _info) -> bool: + @classmethod # type: ignore + def is_type_of(cls: Type, obj: Any, _info: GraphQLResolveInfo) -> bool: return isinstance(obj, (cls, model)) cls = dataclasses.make_dataclass(