I want to create a generic Strawberry type for a pagination result:
T = TypeVar('T')
@strawberry.type
class CursorPaginationResult(Generic[T]):
rows: List[T]
next: str
This seems to work but i would like CursorPaginationResult
to be a subclass of StrawberryContainer
so that it can be unwrapped by strawberry-django. Is there a way to do this?
I intend to use this type like this:
@strawberry.type
class ImtesQuery:
items: CursorPaginationResult[Item] = CustomStrawberryDjangoField()
CustomStrawberryDjangoField
would be a subclass of StrawberryDjangoField
and take care the pagination logic and add arguments for limit
and cursor
.