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
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);
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);
MIT
Join our GraphQL Editor Channel
Leave a star ;)
For a complete guide to contributing to GraphQL Editor, see the Contribution Guide.
- Fork this repo
- Create your feature branch: git checkout -b feature-name
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request