If a generic type implements an interface, and is registered as an extra type, it is not being recognized in the schema.
from typing import Generic, TypeVar
import strawberry
T = TypeVar('T')
@strawberry.interface
class Abstract:
x: str = ''
@strawberry.type
class Real(Generic[T], Abstract):
y: T
@strawberry.type
class Query:
@strawberry.field
def real(self) -> Abstract:
return Real[int](y=0)
schema = strawberry.Schema(Query, types=[Real[int]])
print(schema.execute_sync('{ real { __typename } }'))
raises Abstract type 'Abstract' was resolved to a type 'Real' that does not exist inside the schema.
.
This worked prior to v0.195. IntReal
is present in the schema, but the error references type Real
.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too