Giter Club home page Giter Club logo

gql's Introduction

gql

standard-readme compliant Travis

Tools for working with GraphQL documents

Warning: these tools are still in an early phase and there will be issues. Bug reports and pull-requests are welcome!

Table of Contents

Background

Building GraphQL schemas in the GraphQL native language (i.e. .graphql files) has several benefits over using a programming language:

  • Your data structures are language agnostic so only the resolvers need to be programmed.
  • The GraphQL language is terser than most programming languages. Schemas are simpler to write and understand.
  • Schemas rarely change after compile time; most people won't take advantage of progammatic schemas.
  • Schemas can be accessed without a GraphQL server.

Hopefully the tools in this repository make it easier to work with GraphQL files.

Install

The quickest way to get started is by globally installing the gql command-line interface:

$ npm i -g gql-cli

Packages

Package Description Version Dependencies
gql-cli Command-line interface for gql GraphQL tools npm Dependency Status
gql-format Tools for formatting GraphQL documents npm Dependency Status
gql-merge Tools for merging GraphQL documents npm Dependency Status
gql-lint Tools for linting GraphQL documents npm Dependency Status

Contribute

Feel free to dive in! Open an issue or submit PRs.

gql follows the Contributor Covenant Code of Conduct.

License

MIT (c) Liam Curry

gql's People

Contributors

b04zdotcom avatar liamcurry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gql's Issues

Update gql-merge multiple inheritance syntax

Hi, I'm using gql-merge and when trying to run it against a schema which has multiple inheritance via the updated syntax I'm getting an error:

> ./node_modules/gql-merge/dist/index.js -v -o ./src/appsync/schema.graphql ./src/appsync/graphql/**/*.graphql

(node:83712) UnhandledPromiseRejectionWarning: GraphQLError: Syntax Error GraphQL (2:35) Cannot parse the unexpected character "&".

1: 
2: type CreativeWork implements Node & Output {
                                     ^
3:   id: ID!

    at syntaxError (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/error/syntaxError.js:28:15)
    at readToken (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/lexer.js:247:32)
    at Object.advanceLexer [as advance] (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/lexer.js:46:28)
    at expect (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:963:11)
    at parseName (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:88:15)
    at parseNamedType (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:577:11)
    at parseImplementsInterfaces (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:702:18)
    at parseObjectTypeDefinition (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:681:20)
    at parseTypeSystemDefinition (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:607:16)
    at parseDefinition (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:148:16)
    at parseDocument (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:106:22)
    at parse (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/graphql/language/parser.js:43:10)
    at mergeString (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/gql-merge/dist/index.js:263:39)
    at mergeStrings (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/gql-merge/dist/index.js:254:10)
    at _callee$ (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/gql-merge/dist/index.js:45:46)
    at tryCatch (/Users/xxxxxx/Sites/aaah/xxxxxx/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:62:40)
(node:83712) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:83712) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

graphql/graphql-js#1169

Remove Babel-runtime dependency or have a package.json specifying it as a dependency

The way you packaged this makes little sense to me. I am trying to use the programmatic API in typescript to merge GQL schemas at runtime. I get the error Cannot find module 'babel-runtime/core-js/promise' because of the way you have this bundled in your dist. To make it even more confusing, you've removed the src from npm, so I can't reference the source that shouldn't have that dependency.

This just seems like an incredibly non-standard way to package things.

Build error

I'm doing this

import {mergeStrings} from 'gql-merge';

import authenticationTypeDef from './authentication/typeDefs';
import entitesTypeDef from './entities/typeDefs';
const mergedTypeDefs = mergeStrings([
    authenticationTypeDef,
    entitesTypeDef
]);

and I get the error Error: Cannot find module 'babel-runtime/core-js/promise', so I guess that the logic of the module is attached to the one of the cli as mentioned in #4

PS: in #3 he had the same problem, but there's no further documentation of the process

preserve comments

Not sure if it is a big deal, but I wouldn't mind if we could preserve those comments that are used to generate the descriptions in graphiql.

Thanks
J;

Separate the CLI logic from the LIB logic.

I'm importing mergeFileGlob function into my app code, which is then being built by webpack. But then when I run my code, the CLI logic is running. This is incredibly inconvenient, as it causes my application to quit. Please fix this.

merge does not understand "extend" word

Hello.
I have few schema files loading by server:
------- 1.graphql ---------------
type Query {
}
------ 2.graphql ---------------
type User {
id: ID!
}
extend type Query {
getUser(userId: ID!) : User
}
------ 3.graphql ---------------
type Category {
id: ID!
}
extend type Query {
getCategory(userId: ID!, categoryId: ID!) : Category
}

The problem is that "gql" tool "merge" option does not understand word "extend" that is a legal
word for graphql schema syntax.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.