Skip to content

Commit

Permalink
Merge pull request #4815 from spitfire77/main
Browse files Browse the repository at this point in the history
update create directives docs
  • Loading branch information
Stephen Barlow committed Mar 2, 2021
2 parents 195c9f6 + ee6c926 commit b665bc8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/source/schema/creating-directives.md
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 b665bc8

Please sign in to comment.