Take this example:
@strawberry.type
class Query:
@strawberry.field
def str_str(self) -> List[str]:
ret = []
for i in some_function_returning_a_str_iterable():
ret.append(i)
return ret
It could be written like this:
@strawberry.type
class Query:
@strawberry.field
def str_str(self) -> Iterable[str]:
return some_function_returning_a_str_iterable()
# or even yield from some_function_returning_a_str_iterable()
The graphql_core resolver already supports that: https://github.com/graphql-python/graphql-core/blob/main/src/graphql/execution/execute.py#L678
strawberry just needs to map an Iterable[T]
/AsyncIterable[T]
to [T]
in the schema
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