@graphql-reshape/directives

0.3.3 • Public • Published

@graphql-reshape/directives

GraphQL Reshape Logo

How to install

npm i @graphql-reshape/directives

How to use

  1. Import the directive you would like to use in your schema and using Apollo's makeExecutableSchema() add the directive to the schemaDirectives:

    import { MaskedDirective } from '@graphql-reshape/directives';
    
    const schema = makeExecutableSchema({
      typeDefs,
      schemaDirectives: {
        masked: MaskedDirective
      }
    });
  2. Add the directive schema definition to your schema and use the directive:

    directive @masked(showLast: Int = 4) on FIELD_DEFINITION
    
    type Person {
      name: String!
      dateOfBirth: String! @masked(showLast: 2)
    }

    OR alternatively you can use the @graphql-reshape/cli to apply definitions and directives to your schema with ease.

Package Sidebar

Install

npm i @graphql-reshape/directives

Weekly Downloads

5

Version

0.3.3

License

MIT

Unpacked Size

13.8 kB

Total Files

14

Last publish

Collaborators

  • zieka