Let T = TypeVar("T") ... the extended table might like:
field type | resolver return type | current behaviour | expected behaviour | current type | expected type
-- | -- | -- | -- | -- | --
int | T | no error | no error [1] | int | int
int | GenericClass[T] | runtime error | no errors, no warnings | int | int
int | Optional[T] | runtime error | no errors, no warnings | int | int
Describe the Bug
Following on from: https://github.com/strawberry-graphql/strawberry/pull/1891
The case where a field's resolver has a subclassed generic return type still raises a Type Error. The
isinstance
check is too weak.See this gist for examples: https://gist.github.com/invokermain/31c783c76dd26e1da862cbe5218d2500
System Information
Additional Context
There is a wider discussion about resolver return type hint behaviour here: https://github.com/strawberry-graphql/strawberry/issues/1896
Upvote & Fund