When inheriting from user defined generic (not a strawberry class/type) and including a field with generic type strawberry generates new graphql type
This bug only applies to class fields/annotations and not to methods with strawberry.field
decorator
Gist: https://play.strawberry.rocks/?gist=8f84b94b8f23ec29173fcb1894f41fcf
import abc
from collections.abc import Iterable, Sequence
from typing import TypeVar, Generic, Any, Optional
import strawberry
from strawberry import Schema
T = TypeVar("T")
Self = Any
class UserGeneric(Generic[T]):
pass
class A:
pass
class B:
pass
@strawberry.type(name="B")
class BGQL(UserGeneric[B]):
name: str = "Name"
@strawberry.type(name="A")
class AGQL(UserGeneric[A]):
b: BGQL
@strawberry.type
class Query:
@strawberry.field
async def a(self) -> AGQL:
return AGQL(b=BGQL())
schema = Schema(query=Query, types=(BGQL, ))
type A {
b: BB!
}
type B {
name: String!
}
type BB {
name: String!
}
type Query {
a: A!
}
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