strawberry
strawberry copied to clipboard
Allow using tuple (and/or iterable) as an alias to the GraphQL type
Feature Request Type
Alteration (enhancement/optimization) of existing feature(s)
Description
Returning a tuple
when the attribute is hinted as list
works.
But hinting the return type correctly as a tuple causes an error:
@strawberry.type
class Dictionary:
entries: tuple[Entry]
sources: tuple[Source]
TypeError: Unexpected type tuple[Entry]
Our code uses tuples and iterables whenever appropriate for robustness, efficiency, and documentation. We also use strict type hinting. It'd be great for these read-only sequences to be explicitly supported.