Recall & Review
beginner
What is the main role of a resolver in GraphQL?
A resolver connects the GraphQL schema to the actual data by fetching or computing the data for each field requested.
Click to reveal answer
beginner
Why can't the GraphQL schema fetch data by itself?
The schema only defines the shape and types of data but does not know how or where to get the data; resolvers handle this connection.
Click to reveal answer
intermediate
How do resolvers help in separating concerns in a GraphQL API?
Resolvers separate the data fetching logic from the schema definition, making the API easier to maintain and update.
Click to reveal answer
intermediate
What happens if a resolver is missing for a field in GraphQL?
If no resolver is provided, GraphQL uses a default resolver that tries to return a property with the same name from the parent object.
Click to reveal answer
advanced
Can resolvers fetch data from multiple sources? Why is this useful?
Yes, resolvers can fetch data from databases, APIs, or other services, allowing GraphQL to unify data from many places into one response.
Click to reveal answer
What does a resolver do in GraphQL?
✗ Incorrect
Resolvers are functions that fetch or compute the data for each field defined in the GraphQL schema.
If a field in the schema has no resolver, what happens?
✗ Incorrect
GraphQL uses a default resolver that returns the property with the same name from the parent object if no custom resolver is provided.
Why is it useful that resolvers can fetch data from multiple sources?
✗ Incorrect
Resolvers can gather data from databases, APIs, or other services, enabling GraphQL to unify diverse data sources.
What part of GraphQL defines the shape and types of data?
✗ Incorrect
The schema defines the structure and data types but does not fetch data itself.
How do resolvers improve maintainability of a GraphQL API?
✗ Incorrect
Resolvers keep data fetching logic separate from the schema, making the API easier to update and maintain.
Explain why resolvers are necessary to connect a GraphQL schema to actual data.
Think about what the schema can and cannot do by itself.
You got /3 concepts.
Describe how resolvers help manage data from multiple sources in a GraphQL API.
Consider how data might come from databases, external APIs, or other services.
You got /3 concepts.