3 unstable releases

0.3.0 Jun 6, 2021
0.2.1 Apr 8, 2021
0.2.0 Apr 7, 2021

#7 in #graphql-parser

Download history 6/week @ 2024-02-20 13/week @ 2024-02-27 4/week @ 2024-03-05 10/week @ 2024-03-12 1/week @ 2024-03-19 19/week @ 2024-03-26 49/week @ 2024-04-02

69 downloads per month
Used in 2 crates (via gurkle_codegen)

MIT/Apache

110KB
3K SLoC

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
  3. Schema definition language a/k/a IDL (which is still in RFC)

Example: Parse and Format Query

use gurkle_parser::query::{parse_query, ParseError};

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

Example: Parse and Format Schema

use gurkle_parser::schema::{parse_schema, ParseError};

let ast = parse_schema(r#"
    schema {
        query: Query
    }
    type Query {
        users: [User!]!,
    }
    """
       Example user object

       This is just a demo comment.
    """
    type User {
        name: String!,
    }
"#)?;
// Format canonical representation
assert_eq!(format!("{}", ast), "\
schema {
  query: Query
}

type Query {
  users: [User!]!
}

\"\"\"
  Example user object

  This is just a demo comment.
\"\"\"
type User {
  name: String!
}
");

Dependencies

~1.2–1.9MB
~40K SLoC