返回主题:GraphQL 模式、查询与执行

知识卡片

普通读书笔记卡 · 3505.d

嵌套选择沿对象关系取值

理解等级:中级

GraphQL 对象字段指向另一对象时,查询要在该字段下继续写嵌套选择集。沿产品、配方原料、供应商的字段连接逐层选择,能在一次查询中取得相关对象的指定字段;实际成本仍取决于服务端解析方式。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 9 章《Consuming GraphQL APIs》(源文件:_epub-src/OEBPS/Text/09.htm) - 结论依据:原文通过 ProductInterface 到 IngredientRecipe、Ingredient、Supplier 的查询展示嵌套选择。 - 原始内容:we must include a nested selection set for said object type. For example, if we add a selector for the ingredient property on the ProductInterface type