知识卡片

普通读书笔记卡 · 3509

先由模式列出实现职责

理解等级:中级

实现 GraphQL API 前,先从模式逐项列出对象类型、根查询、变更操作和返回类型。普通对象需产出符合字段约束的数据;联合类型还要能判定每个结果的具体类型。这样可把契约中的要求转为解析器和类型判定任务。

这张卡片看不懂?

已有反馈 · 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.