动手做Get your hands on it
练习跟着课文走 —— 每节课尾都有本课的练习。这一页是全部练习的总库,想集中刷题的时候来。 每个练习都写清了它来自哪一节,卡住了就回去看那一节。Practice follows the lessons — every lesson ends with the exercises for that lesson. This page is the whole library, for when you want to drill in one sitting. Each exercise names the lesson it came from, so you can go back when you stall.
已筛到你正在学的《Federation 考试》。想看全部就点上面的「全部」。Filtered to Federation exam — the course you are on. Use “All” above to see everything.
练习Exercises
筛出 23 个练习(共 148 个) · 第 1 / 2 页。Showing 23 of 148 · page 1 / 2.看真实 schema 里的 type Order。 下面哪些字段的类型是标量(不能再往下展开)?(多选)
Look at type Order in the real schema. Which of these fields have a scalar type — one that cannot be expanded any further? (Select all that apply.)
graphql-federation-practice/node-subgraph/src/schema.graphql这题是多选。More than one answer is correct.
真实 schema 里 createOrder 放在type Mutation 下。如果把它挪到type Query 下会怎样?
In the real schema, createOrder sits under type Mutation. What happens if you move it under type Query?
照 index.js 里 context 的真实结构, 哪个写法能拿到订单数据源?
Going by the real shape of context in index.js, which of these reads the order data source?
Order.shippingInfo 需要知道「是哪个 order 的物流」。 这个 order 的 id 从哪个参数拿?
Order.shippingInfo has to know which order the shipping belongs to. Which argument holds that order's id?
schema 写的是 orders(userId: ID!): [Order!]!。 user 999 没有任何订单。resolver 该返回什么?
The schema says orders(userId: ID!): [Order!]!. User 999 has no orders at all. What should the resolver return?
客户端调 createOrder(userId: "789", items: [{ productId: "prod-789", quantity: 2 }])。 如果 resolver 把 items 原样交给orderDataSource.createOrder,会怎样?
The client calls createOrder(userId: "789", items: [{ productId: "prod-789", quantity: 2 }]). What happens if the resolver hands items straight to orderDataSource.createOrder?
下面哪一条最准确地描述了 Federation 要解决的核心问题?
Which of these describes most accurately the core problem Federation sets out to solve?
下面哪些是这个 assessment 仓库里没有的?(多选)
Which of these are not in this exam repository? (Select all that apply.)
这题是多选。More than one answer is correct.
schema.graphql 里从头到尾没有出现_entities,但 Router 能查它。它从哪来?
_entities appears nowhere in schema.graphql, yet the Router can query it. Where does it come from?
仓库里没有 Router。你想确认自己的 User.orders在 federation 链路里能被正确调用。最直接的办法?
There is no Router in the repository. You want to confirm your User.orders is called correctly along the federation path. What is the most direct way?
type User @key(fields: "id") 最准确的含义是?
What does type User @key(fields: "id") mean, most precisely?
__resolveReference 返回 { id: user.id }。 那么 User.orders(user, ...) 里的 user上有哪些属性?
__resolveReference returns { id: user.id }. So which properties does user have inside User.orders(user, ...)?