graphql-js-tree is a JavaScript library for parsing GraphQL Schema Definition Language (SDL) and GraphQL queries into a simplified, pure graph JSON structure. Unlike the standard `graphql-js` parser, which retains extensive text-specific Abstract Syntax Tree (AST) information, `graphql-js-tree` focuses on generating a more streamlined representation. This simplified structure makes it significantly easier to work with programmatically, abstracting away much of the raw AST complexity. The current stable version is 3.0.4. It serves as a foundational component for larger projects like `graphql-zeus` and `graphql-editor`, providing a pragmatic approach to GraphQL parsing. While a precise release cadence isn't explicitly specified, its integral role in other active projects suggests ongoing maintenance and development.
npm install graphql-js-treeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates parsing a GraphQL SDL schema into `graphql-js-tree`'s simplified internal representation and then reconstructing it back into an SDL string, showcasing the core `Parser` and `TreeToGraphQL` functionalities.
Consult the official GitHub repository's release notes or commit history for specific migration details between major versions. Update code to align with the new API surface and data structures.
Install a compatible `graphql` version (e.g., `npm install graphql@17`). Use `npm ls graphql` or `yarn why graphql` to check for and resolve version conflicts in your dependency tree.
Ensure the package is installed: `npm install graphql-js-tree` or `yarn add graphql-js-tree`. Verify the import statement for correct path and symbol names.
Ensure `Parser` is imported as a named export: `import { Parser } from 'graphql-js-tree';` and then called as `Parser.parse(...)`.