Skip to content

Commit 2136a7d

Browse files
Update directives.md
1 parent 61ceebf commit 2136a7d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

content/graphql/directives.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A directive is an identifier preceded by a `@` character, optionally followed by
1313
To create a custom schema directive, declare a class which extends the `SchemaDirectiveVisitor` class exported from the `apollo-server` package.
1414

1515
```typescript
16-
import { SchemaDirectiveVisitor } from 'apollo-server';
16+
import { SchemaDirectiveVisitor } from '@graphql-tools/utils';
1717
import { defaultFieldResolver, GraphQLField } from 'graphql';
1818

1919
export class UpperCaseDirective extends SchemaDirectiveVisitor {
@@ -31,6 +31,8 @@ export class UpperCaseDirective extends SchemaDirectiveVisitor {
3131
```
3232

3333
> info **Hint** Note that directives cannot be decorated with the `@Injectable()` decorator. Thus, they are not able to inject dependencies.
34+
>
35+
> warning **Warning** `SchemaDirectiveVisitor` is exported from the `@graphql-tools/utils` package so make sure to install it in your project.
3436
3537
Now, register the `UpperCaseDirective` in the `GraphQLModule.forRoot()` method:
3638

0 commit comments

Comments
 (0)