🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@cdmbase/graphql-schema-collector

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cdmbase/graphql-schema-collector

Aggregate Schema module into one Schema by loading .graphql files based a glob pattern

0.3.0
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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 @cdmbase/graphql-schema-collector

Usage

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('@cdmbase/graphql-schema-collector')

loader.loadSchema('./schema/*.graphql', (err, schema) => {
  console.log(schema.getQueryType().toString())
})

Create a schema using promises:

const loader = require('@cdmbase/graphql-schema-collector')

loader.loadSchema('./schema/*.graphql').then((schema) => {
  console.log(schema.getQueryType().toString())
})

Create a schema using sync:

const loader = require('@cdmbase/graphql-schema-collector')

const schema = loader.loadSchema.sync('./schema/*.graphql')
console.log(schema.getQueryType().toString())

Development

Build

npm run build

Run test in watch mode

npm run test:watch

License

This project is licensed under Apache License Version 2.0

Keywords

GraphQL

FAQs

Package last updated on 22 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts