Annotate return type in Strawberry GraphQL Query

964 views Asked by At
@strawberry.field(description="description of query")
    def sample_query(arg1: Annotated[str, strawberry.argument(description="description of arg1")]) -> list[str]:
...

How do I annotate the output with a description? This was the PR that allowed for arguments: https://github.com/strawberry-graphql/strawberry/issues/509

1

There are 1 answers

0
A. Coady On BEST ANSWER

GraphQL doesn't support output descriptions. If the output was a custom type, the type would have its own description. But in this case, I think including the output in the field description is the only option.