Recall & Review
beginner
What is a subgraph in GraphQL?
A subgraph is a smaller part of a larger GraphQL graph. It defines a set of types and fields that focus on a specific domain or service.
Click to reveal answer
beginner
What does a
subgraph definition usually include?It includes the schema with types, queries, mutations, and sometimes directives that describe the data and operations for that subgraph.
Click to reveal answer
intermediate
Why do we use subgraphs in a GraphQL architecture?
Subgraphs help split a big graph into smaller, manageable parts. This makes development easier and allows teams to work independently on different domains.
Click to reveal answer
intermediate
How does a subgraph relate to a federated GraphQL gateway?
A federated gateway combines multiple subgraphs into one unified graph. Each subgraph provides part of the overall schema that the gateway merges.
Click to reveal answer
advanced
What is the role of the
@key directive in a subgraph definition?The
@key directive marks a field or set of fields as a unique identifier for an entity. It helps the gateway know how to reference and join data across subgraphs.Click to reveal answer
What does a subgraph in GraphQL represent?
✗ Incorrect
A subgraph is a focused part of the overall graph, representing a domain or service.
Which directive is commonly used in subgraph definitions to identify entities uniquely?
✗ Incorrect
The @key directive marks fields as unique identifiers for entities in subgraphs.
What is the main purpose of splitting a GraphQL schema into subgraphs?
✗ Incorrect
Splitting into subgraphs helps teams work independently and manage complexity.
In a federated GraphQL setup, what combines the subgraphs into one schema?
✗ Incorrect
The federated gateway merges subgraphs into a single unified schema.
Which of the following is NOT typically part of a subgraph definition?
✗ Incorrect
UI components are not part of a subgraph definition; subgraphs define schema and resolvers.
Explain what a subgraph definition is and why it is useful in GraphQL.
Think about how big projects can be divided into smaller pieces.
You got /4 concepts.
Describe the role of the @key directive in a subgraph definition and how it helps federation.
Focus on how different subgraphs connect their data.
You got /3 concepts.