Skip to content

Commit ca28bf2

Browse files
committed
nits
1 parent cc6dfd2 commit ca28bf2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

website/pages/docs/using-directives.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Using Directives in GraphQL.js
33
sidebarTitle: Using Directives
44
---
55

6+
# Using Directives in GraphQL.js
7+
68
Directives let you customize query execution at a fine-grained level. They act like
79
annotations in a GraphQL document, giving the server instructions about whether to
810
include a field, how to format a response, or how to apply custom behavior.
@@ -178,9 +180,9 @@ a resolver.
178180
## Implementing custom directive behavior
179181

180182
GraphQL.js doesn't execute custom directive logic for you. You must handle it during
181-
execution. There are two common approaches:
183+
execution. There are two common approaches:
182184

183-
1. Handle directives in resolvers
185+
### 1. Handle directives in resolvers
184186

185187
Inside a resolver, use the `info` object to access AST nodes and inspect directives.
186188
You can check whether a directive is present and change behavior accordingly.
@@ -229,7 +231,7 @@ console.log(result);
229231
// → { data: { greeting: 'HELLO, WORLD' } }
230232
```
231233
232-
2. Use AST visitors or schema wrappers
234+
### 2. Use AST visitors or schema wrappers
233235
234236
For more complex logic, you can preprocess the schema or query using AST visitors or wrap
235237
field resolvers. This lets you inject directive logic globally across

0 commit comments

Comments
 (0)