Crate graphql_parser [] [src]

Graphql Parser

This library contains full parser and formatter of the graphql query language as well as AST types.

Docs | Github | Crate

Current this library supports full graphql syntax, and the following extensions:

  1. Subscriptions
  2. Block (triple quoted) strings

Example: Parse and Format Query

use graphql_parser::parse_query;

let ast = parse_query("query MyQuery { field1, field2 }")?;
// Format canonical representation
assert_eq!(format!("{}", ast), "\
query MyQuery {
  field1
  field2
}
");

Modules

format

Formatting graphql

query

Query Language Abstract Syntax Tree (AST)

Structs

Pos

Original position of element in source code

Functions

parse_query

Parses a piece of query language and returns an AST