知识卡片
先由模式列出实现职责
实现 GraphQL API 前,先从模式逐项列出对象类型、根查询、变更操作和返回类型。普通对象需产出符合字段约束的数据;联合类型还要能判定每个结果的具体类型。这样可把契约中的要求转为解析器和类型判定任务。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 10 章《Building GraphQL APIs with Python》(源文件:_epub-src/OEBPS/Text/10.htm)
- 结论依据:原文先分析 Ingredient 与 Product 返回类型的不同实现需求,联合类型需要额外识别具体类型。
- 原始内容:The specification defines a collection of object types that represent the data we can retrieve from the API and a set of queries and mutations that expose the capabilities of the products service.