@ryanchenkie
"Directives provide a way to describe alternate runtime execution and type validation behavior in a GraphQL document."
– GraphQL Spec 2.12 (June 2018 release)
"GraphQL implementations should provide the @skip and @include directives."
– GraphQL Spec 3.13 (June 2018 release)
"GraphQL implementations that support the type system definition language must provide the @deprecated directive if representing deprecated portions of the schema."
– GraphQL Spec 3.13 (June 2018 release)
SchemaDirectiveVisitor
visitFieldDefinition
visitObject
visitSchema
visitScalar
visitArgumentDefinition
visitInterface
visitUnion
visitEnum
visitEnumValue
visitInputObject
visitInputFieldDefinition
What is the directive named?
What arguments does it take?
Where does it work?
Target field definitions
Get the argument passed in
Resolve the field with "something different"
Register the schema directive
Put the directive on any fields desired
npm install graphql-middleware
Lots of tooling needed to get around these problems
bit.ly/custom-schema-directives
@ryanchenkie