0.2.5 • Published 9 years ago
graphql-schema-collector v0.2.5
graphql-loader
Instantiate a GraphQL Schema by loading GraphQL Schema Language files based on a glob pattern
- Allows creation of GraphQL Schema via GraphQL schema language shorthand
 - Supports splitting the schema into modules
 - Parse and validate schema files
 
Installation
npm install --save graphql @creditkarma/graphql-loaderUsage
Given the following files
schema/schema.graphql
schema {
  query: RootQuery
}schema/rootQuery.graphql
type RootQuery {
  testString: String
}Create a schema with the following code:
const loader = require('@creditkarma/graphql-loader')
loader.loadSchema('./schema/*.graphql', (err, schema) => {
  console.log(schema.getQueryType().toString())
})Create a schema using promises:
const loader = require('@creditkarma/graphql-loader')
loader.loadSchema('./schema/*.graphql').then((schema) => {
  console.log(schema.getQueryType().toString())
})Create a schema using sync:
const loader = require('@creditkarma/graphql-loader')
const schema = loader.loadSchema.sync('./schema/*.graphql')
console.log(schema.getQueryType().toString())Development
Install dependencies with
npm install
npm run typingsBuild
npm run buildRun test in watch mode
npm run test:watchContributing
For more information about contributing new features and bug fixes, see our Contribution Guidelines. External contributors must sign Contributor License Agreement (CLA)
License
This project is licensed under Apache License Version 2.0