Skip to main content

parse_graphql_document

Function parse_graphql_document 

Source
pub fn parse_graphql_document(
    query: &str,
) -> Result<Document<'_, String>, ComplexityValidationError>
Expand description

Parse a GraphQL query source into a graphql_parser document.

Exposed so the server’s HTTP handler can parse the request exactly once and reuse the AST for both complexity validation (via RequestValidator::validate_query_doc) and the downstream execution path — replacing the previous “validate then re-parse” pattern. See F001 in IMPROVEMENTS.md.

§Errors

Returns ComplexityValidationError::MalformedQuery when the source fails to parse as a GraphQL query document.