Skip to content

GraphQL Mask lets you subtract everything outside a schema from a query

Notifications You must be signed in to change notification settings

sjensen85/graphql-mask

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql-mask

Greenkeeper badge

CircleCI npm package npm downloads

Graphql Mask is a simple utility for removing everything in a query that is not defined in a schema. Use it the same way you would use the library function for graphql-js e.g. graphqlMask(schema, query) but instead of getting back results, you will get back a trimmed down query.

Usage

$ npm install graphql-mask
# or 
$ yarn add graphql-mask
const graphqlMask = require("graphql-mask");

const result = graphqlMask(`
  type Query {
    something: String!
    somethingElse: Int
  }
`,`
  query ExampleQuery {
    something
    somethingElse
    somethingNotInSchema
  }
`)

console.log(result)

This will print...

query ExampleQuery {
  something
  somethingElse
}

About

GraphQL Mask lets you subtract everything outside a schema from a query

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%