Q7: What are the four standard arguments passed to a GraphQL resolver?
Standard GraphQL resolvers in JavaScript environments receive four positional arguments:
parent(orobj): The result returned from the resolver on the parent field.args: The parameters/arguments passed into the field in the GraphQL query.context: Shared contextual state across all resolvers in a request (e.g., auth user, DB instances).info: AST and execution information regarding the query state.
Key Takeaways
- Resolver arguments are
(parent, args, context, info). contextis the primary mechanism for sharing request-scoped objects like database connections.
Knowledge Check
Which resolver argument contains the current authenticated user object?