Skip to content

Commit 2815b45

Browse files
Merge pull request #1416 from wSedlacek/patch-1
docs(graphql): Complexity on Query and Mutation
2 parents 021561e + 1edf746 commit 2815b45

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

content/graphql/complexity.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,14 @@ Alternatively, you can define the estimator function:
8484
@Field({ complexity: (options: ComplexityEstimatorArgs) => ... })
8585
title: string;
8686
```
87+
88+
#### Query/Mutation-level complexity
89+
90+
In addition, `@Query()` and `@Mutation()` decorators may have a `complexity` property specified like so:
91+
92+
```typescript
93+
@Query({ complexity: (options: ComplexityEstimatorArgs) => options.args.count * options.childComplexity })
94+
items(@Args('count') count: number) {
95+
return this.itemsService.getItems({ count });
96+
}
97+
```

0 commit comments

Comments
 (0)