Q7: What are the four standard arguments passed to a GraphQL resolver?

Difficulty:EasyTopic:Execution

Standard GraphQL resolvers in JavaScript environments receive four positional arguments:

  1. parent (or obj): The result returned from the resolver on the parent field.
  2. args: The parameters/arguments passed into the field in the GraphQL query.
  3. context: Shared contextual state across all resolvers in a request (e.g., auth user, DB instances).
  4. info: AST and execution information regarding the query state.
Key Takeaways
  • Resolver arguments are (parent, args, context, info).
  • context is the primary mechanism for sharing request-scoped objects like database connections.
Knowledge Check

Which resolver argument contains the current authenticated user object?