Library for Parsing GraphQL

The query parameter is not json, it is a graphql query document in string form. Rust does not have an easy way to deal with it.

I do need a parser like neo4j-graphql-js.

neo4jgraphql(object, params, ctx, resolveInfo);

Ah so you are talking about scenario 1.

Rust does not have an easy way to deal with it.

yes it does

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

let ast = parse_query::<&str>(query)?.to_owned();

// edit the AST
// ...

// use the edited AST  as a new query
let newQuery = format!("{}", ast);

I know graphql-parser, but it does not parse graphql request parameters, it parses graphql schema.

You can use parse_query instead of parse_schema

docs

Thank you. I haven’t used it, maybe I can try it.

2 posts were merged into an existing topic: Go Libray for GraphQL schema parsing