strawberry-graphql/strawberry

Add better support for nested generics

Opened this issue · 0 comments

This snippet is broken, because we don't check nested type var, we have done something similar here: #3463

import strawberry


@strawberry.type
class Wrapper[T]:
    value: T


@strawberry.type
class BlockRow[T]:
    item: Wrapper[T]


@strawberry.type
class Query:
    @strawberry.field
    def blocks(self) -> list[BlockRow[str] | BlockRow[int]]:
        return [
            BlockRow(item=Wrapper(value="Hello")),
            BlockRow(item=Wrapper(value=1)),
        ]


schema = strawberry.Schema(query=Query)

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar