Skip to content

Commit 1bbe8db

Browse files
Add example for giving an argument a description (#3964)
* Add example for giving an argument a description * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update queries.md --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9cef2c3 commit 1bbe8db

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/general/queries.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,23 @@ class Query:
101101
return fruit
102102
return None
103103
```
104+
105+
### Argument Descriptions
106+
107+
Use `Annotated` to give a field argument a description:
108+
109+
```python
110+
from typing import Annotated
111+
import strawberry
112+
113+
114+
@strawberry.type
115+
class Query:
116+
@strawberry.field
117+
def fruit(
118+
self,
119+
startswith: Annotated[
120+
str, strawberry.argument(description="Prefix to filter fruits by.")
121+
],
122+
) -> str | None: ...
123+
```

0 commit comments

Comments
 (0)