graphql-js-tree
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

npm Commitizen friendly npm downloads

Simplier approach to GraphQL parsing. Using graphql-js library and parsing AST to simplier types. It is a backbone of graphql-zeus and graphql-editor

How it works

SDL GraphQL

It creates very simple ParserTree from GraphQL schema

import { Parser, TreeToGraphQL } from 'graphql-js-tree';

const schemaFileContents = `
type Query{
    hello: String!
}
schema{
    query: Query
}
`;

const parsedSchema = Parser.parse(schemaFileContents);

// Backwards

const graphqlString = TreeToGraphQL.parse(parsedSchema);

GQL

import { parseGql } from 'graphql-js-tree';

const schemaFileContents = `
type Query{
    hello: String!
}
schema{
    query: Query
}
`;

const gqlQuery = `
    query MyQuery{
        hello
    }
`;

const parsedTrees = parseGql(gqlQuery, schemaFileContents);

// Backwards

const gqlString = parseGqlTrees(parsedTrees);

Table of contents

License

MIT

Support

Join our GraphQL Editor Channel

Leave a star ;)

Contribute

For a complete guide to contributing to GraphQL Editor, see the Contribution Guide.

  1. Fork this repo
  2. Create your feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Readme

Keywords

none

Package Sidebar

Install

npm i graphql-js-tree

Weekly Downloads

12,515

Version

2.0.0

License

MIT

Unpacked Size

128 kB

Total Files

78

Last publish

Collaborators

  • slothking