Skip to content

Commit

Permalink
update create directives docs
Browse files Browse the repository at this point in the history
  • Loading branch information
spitfire1236 committed Dec 26, 2020
1 parent ab104b7 commit 7d1608b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/source/schema/creating-directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ Suppose your resolver returns a `Date` object but you want to return a formatted

```js
const { ApolloServer, gql, SchemaDirectiveVisitor } = require("apollo-server");
const { defaultFieldResolver } = require('graphql');


const typeDefs = gql`
directive @date(format: String) on FIELD_DEFINITION
Expand Down Expand Up @@ -295,6 +297,7 @@ Here's how you might make sure `translate` is used to localize the `greeting` fi

```js
const { ApolloServer, gql, SchemaDirectiveVisitor } = require("apollo-server");
const { defaultFieldResolver } = require('graphql');

const typeDefs = gql`
directive @intl on FIELD_DEFINITION
Expand Down Expand Up @@ -358,6 +361,7 @@ What makes this example tricky is that the `OBJECT` version of the directive nee

```js
const { ApolloServer, gql, SchemaDirectiveVisitor } = require("apollo-server");
const { defaultFieldResolver } = require('graphql');

class AuthDirective extends SchemaDirectiveVisitor {
visitObject(type) {
Expand Down

0 comments on commit 7d1608b

Please sign in to comment.