Skip to content

Commit

Permalink
fix type checking on is_type_of
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecRosenbaum authored Nov 23, 2021
1 parent fdc290a commit 5a12b9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions strawberry/experimental/pydantic/object_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 5a12b9c

Please sign in to comment.