知识卡片

普通读书笔记卡 · 3505

选择集明确返回字段

理解等级:初级

GraphQL 查询使用选择集列出希望返回的字段;对象字段还要继续选择其子字段。客户端由此控制结果的形状,遗漏必需的选择集会触发查询错误。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 9 章《Consuming GraphQL APIs》(源文件:_epub-src/OEBPS/Text/09.htm) - 结论依据:原文定义花括号内的选择集,并说明缺失时会返回错误。 - 原始内容:The block within curly braces is called a selection set . GraphQL queries must always include a selection set. If you don’t include it, you’ll get an error response from the server.