@graphql-reshape/directives
v0.3.3
Published
A collection of custom graphql directives
Downloads
11
Maintainers
Readme
@graphql-reshape/directives
How to install
npm i @graphql-reshape/directives
How to use
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 } });
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.