platform/graphql_parser
2018-08-02 10:16:46 -04:00
..
.dart_tool/pub/bin Go async 2018-08-02 09:53:47 -04:00
example Restructure 2018-08-02 08:48:53 -04:00
lib Finished querying (missing interface+union types) 2018-08-02 10:16:46 -04:00
test Fix Dart 1 error 2018-08-02 09:25:41 -04:00
.gitignore Restructure 2018-08-02 08:48:53 -04:00
analysis_options.yaml Fix type errors in tests 2018-08-02 09:05:52 -04:00
graphql_parser.iml Fix type errors in tests 2018-08-02 09:05:52 -04:00
LICENSE Restructure 2018-08-02 08:48:53 -04:00
pubspec.yaml Fix type errors in tests 2018-08-02 09:05:52 -04:00
README.md Restructure 2018-08-02 08:48:53 -04:00

graphql_parser

Pub build status

Parses GraphQL queries and schemas. Also includes a GraphQLVisitor class.

This library is merely a parser/visitor. Any sort of actual GraphQL API functionality must be implemented by you, or by a third-party package.

Angel framework users should consider package:angel_graphql as a dead-simple way to add GraphQL functionality to their servers.

Installation

Add graphql_parser as a dependency in your pubspec.yaml file:

dependencies:
  graphql_parser: ^1.0.0

Usage

The AST featured in this library is directly based off this ANTLR4 grammar created by Joseph T. McBride: https://github.com/antlr/grammars-v4/blob/master/graphql/GraphQL.g4

import 'package:graphql_parser/graphql_parser.dart';

doSomething(String text) {
  var tokens = scan(text);
  var parser = new Parser(tokens);
  
  // Parse the GraphQL document using recursive descent
  var doc = parser.parseDocument();
  
  // Do something with the parsed GraphQL document...
}