Challenge - 5 Problems
Federation Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why does federation improve GraphQL scalability?
Which of the following best explains why federation helps GraphQL scale better?
Attempts:
2 left
💡 Hint
Think about how dividing work among smaller parts can help handle more requests.
✗ Incorrect
Federation breaks a big GraphQL schema into smaller, manageable services. Each service can be developed and scaled independently, improving overall scalability.
❓ query_result
intermediate2:00remaining
Result of federated GraphQL query
Given two federated services: Users and Products, what will be the result of this query?
{
user(id: "1") {
name
purchasedProducts {
name
}
}
}
Assuming user 1 has purchased two products: 'Book' and 'Pen'.
Attempts:
2 left
💡 Hint
Federation allows combining data from multiple services in one query.
✗ Incorrect
Federation merges data from Users and Products services, so the query returns user info plus purchased products.
📝 Syntax
advanced2:00remaining
Identify the syntax error in this federation SDL
Which option contains the correct syntax for extending a type in a federated GraphQL schema?
Given this partial schema:
extend type Product @key(fields: "id") {
id: ID! @external
price: Float
}
Which option fixes the syntax error?
Attempts:
2 left
💡 Hint
Look carefully at the placement of keywords and quotes.
✗ Incorrect
Option C uses correct syntax: 'extend type', '@key' with quoted fields, and 'id' marked as non-null with @external.
❓ optimization
advanced2:00remaining
Optimizing federated GraphQL queries
Which approach best optimizes performance in a federated GraphQL setup when multiple services are involved?
Attempts:
2 left
💡 Hint
Think about reducing the number of network calls and data fetching.
✗ Incorrect
Batching requests and minimizing nested queries reduce network calls and improve response times in federated systems.
🔧 Debug
expert3:00remaining
Debugging a federation key mismatch error
You have two federated services: Users and Orders.
Users service defines:
type User @key(fields: "id") {
id: ID!
name: String
}
Orders service defines:
type User @key(fields: "userId") {
userId: ID!
orders: [Order]
}
When querying user orders, you get an error about key mismatch. What is the cause?
Attempts:
2 left
💡 Hint
Check if the key fields used to identify the same type are consistent across services.
✗ Incorrect
Federation requires the @key fields to match exactly across services to correctly identify the same entity.