All Projects → creditkarma → Graphql Loader

creditkarma / Graphql Loader

Licence: apache-2.0
Instantiate a GraphQL Schema by loading GraphQL Schema Language files based on a glob pattern

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Graphql Loader

Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (+280.73%)
Mutual labels:  graphql-schema
Strawberry
A new GraphQL library for Python 🍓
Stars: ✭ 891 (+717.43%)
Mutual labels:  graphql-schema
Snowflaqe
A dotnet CLI tool to work with GraphQL queries: static query verification, type checking and code generating type-safe clients for F# and Fable.
Stars: ✭ 69 (-36.7%)
Mutual labels:  graphql-schema
Get Graphql Schema
Fetch and print the GraphQL schema from a GraphQL HTTP endpoint. (Can be used for Relay Modern.)
Stars: ✭ 443 (+306.42%)
Mutual labels:  graphql-schema
Type Graphql
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
Stars: ✭ 6,864 (+6197.25%)
Mutual labels:  graphql-schema
Fullstack Graphql
🌈 Simple Fullstack GraphQL Application. API built with Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with React + Redux to access the API. Written in ES6 using Babel + Webpack.
Stars: ✭ 955 (+776.15%)
Mutual labels:  graphql-schema
Vim Graphql
A Vim plugin that provides GraphQL file detection, syntax highlighting, and indentation.
Stars: ✭ 357 (+227.52%)
Mutual labels:  graphql-schema
Graphql Transform Schema
Transform, filter & alias resolvers of a GraphQL schema
Stars: ✭ 84 (-22.94%)
Mutual labels:  graphql-schema
Graphql Code Generator
A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
Stars: ✭ 7,993 (+7233.03%)
Mutual labels:  graphql-schema
Graphql Typescript
Define and build GraphQL Schemas using typed classes
Stars: ✭ 67 (-38.53%)
Mutual labels:  graphql-schema
Graphql Cost Analysis
A Graphql query cost analyzer.
Stars: ✭ 527 (+383.49%)
Mutual labels:  graphql-schema
Graphql
Pure PHP realization of GraphQL protocol
Stars: ✭ 717 (+557.8%)
Mutual labels:  graphql-schema
Sql To Graphql Schema Generator
⚛️ Generate GraphQL Scheme Online From SQL Query - https://sql-to-graphql.now.sh/
Stars: ✭ 32 (-70.64%)
Mutual labels:  graphql-schema
Graphql Tools
🔧 Build, mock, and stitch a GraphQL schema using the schema language
Stars: ✭ 4,556 (+4079.82%)
Mutual labels:  graphql-schema
Graphql Schema Language Cheat Sheet
GraphQL Shorthand Notation Cheat Sheet
Stars: ✭ 1,181 (+983.49%)
Mutual labels:  graphql-schema
Graphql Auto Generating Cms
Use your existing graphQL schema to generate CMS in a couple steps. DEMO: http://cms-demo.web4fly.com/
Stars: ✭ 373 (+242.2%)
Mutual labels:  graphql-schema
Graphql Config
One configuration for all your GraphQL tools (supported by most tools, editors & IDEs)
Stars: ✭ 883 (+710.09%)
Mutual labels:  graphql-schema
Graphql Log
Add logging to your GraphQL resolvers so you know what's going on in your app.
Stars: ✭ 94 (-13.76%)
Mutual labels:  graphql-schema
Graphql Validator
A CLI tool to validate queries against a GraphQL Schema. The primary use case for this tool is to validate schema changes against an existing query store.
Stars: ✭ 80 (-26.61%)
Mutual labels:  graphql-schema
Graphql Modules
⚠️ [DEPRECATED] GraphQL module library for Apollo.
Stars: ✭ 53 (-51.38%)
Mutual labels:  graphql-schema

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
  • Load GraphQL files from different modules and merge them into a single GraphQL Schema

Installation

npm install --save graphql @creditkarma/graphql-loader

Usage

Given the following files

schema/schema.graphql

schema {
  query: RootQuery
}

schema/rootQuery.graphql

type RootQuery {
  testString: String
}

loadSchema

Given a GLOB pattern, it will load all the content of the files matching the GLOB, combine them together and return a GraphQL Schema

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 with a callback:

const loader = require('@creditkarma/graphql-loader')

loader.loadSchema('./schema/*.graphql', (err, 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())

executableSchemaFromModules

Given an array of GraphQL Modules or functions that returns a GraphQL Module or Promise, merge the documents and resolvers together and return an executable GraphQL Schema

GraphQL modules are comprised of a document node and resolvers to provide away to decompose a GraphQL server into stand alone Node.js modules. These modules expose a DocumentNode because document nodes are valid GraphQL segments that are not required to be a complete valid schema.

It is required that the combination of GraphQLModules results in a completely valid GraphQLSchema.

const modules = [
  () => loadDocument('./fixtures/user/**/*.graphql').then((document) => ({ document, resolvers: {}})),
  () => loadDocument('./fixtures/swapi/**/*.graphql').then((document) => ({ document, resolvers: {}})),
]
executableSchemaFromModules(modules).then((schema) => {
  console.log(schema.getQueryType().toString())
})

loadDocument

Given a GLOB pattern, load the matching files, combine them together and return a GraphQL AST in the form of a DocumentNode. The document node will be parsed and validate but doesn't have to meet all the requirements of a full schema definition. For example, it is possible to just load several files with only types defined. NOTE: You must use a DocumentNode with the combineDocuments function

Load several GraphQL files into a single DocumentNode

const loader = require('@creditkarma/graphql-loader')

loader.loadDocument('./schema/*.graphql').then((doc) => {
  console.log(doc)
})

combineDocuments

Given an array of DocumentNodes, merge them together and return a GraphQLSchema

  • Any duplicate Type definitions will be merged by concatenating their fields
  • Any duplicate Schema definitions will be merged by concatenating their operations

Combine several documents into a GraphqlSchema

const loader = require('@creditkarma/graphql-loader')

Promise.all(
  loader.loadDocument('./ships/graphql/**/*.graphql'),
  loader.loadDocument('./planets/graphql/**/*.graphql')
).then((docs) => {
  const schema = combineDocuments(docs)
  console.log(schema.getQueryType().toString())
})

Development

Install dependencies with

npm install

Build

npm run build

Run test in watch mode

npm run test:watch

Contributing

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].