@graphql-reshape/transformers
v0.5.1
Published
A collections of transformers that parse graphql schema definition language, add specific directives to qualifying fields, and return the parsed document
Downloads
2
Maintainers
Readme
@graphql-reshape/transformers
How to install
npm i @graphql-reshape/transformers
string -> [DocumentNode | string , boolean]
What is a transformer in this context?
A transformer is a function that takes in a graphql schema definition language (SDL) as a string and returns an array where the first element is the parsed schema or original string if not parsable and the second element is a boolean representing if the transform changed anything.
A transformer also can take an optional second argument which is an object that holds specific options for the transformer
How to use
Import the transformer directly and apply call it with a graphl schema (DocumentNode | string
). This will return a parsed schema AST with the directive added. Typically you can then print the DocumentNode
if you wanted to get back to the graphl schema definition language or you can pass the parsed DocumentNode
to some function that can consume it like Apollo's makeExecutableSchema()