Back to Graphql Ruby

Phases of Execution

guides/queries/phases_of_execution.md

2.6.1695 B
Original Source

When GraphQL receives a query string, it goes through these steps:

  • Tokenize: {{ "GraphQL::Language::Lexer" | api_doc }} splits the string into a stream of tokens
  • Parse: {{ "GraphQL::Language::Parser" | api_doc }} builds an abstract syntax tree (AST) out of the stream of tokens
  • Validate: {{ "GraphQL::StaticValidation::Validator" | api_doc }} validates the incoming AST as a valid query for the schema
  • Analyze: If there are any query analyzers, they are run with {{ "GraphQL::Analysis.analyze_query" | api_doc }}
  • Execute: The query is traversed, resolve functions are called and the response is built
  • Respond: The response is returned as a {{ "GraphQL::Query::Result" | api_doc }}