← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 3224.b

契约不等于模式符合

理解等级:高级

模式校验只说明消息符合 OpenAPI 等结构约束;契约还绑定具体消费者与生产者认可的一次请求响应交互及示例。两者可互补:模式保证结构底线,契约保护真实依赖。即使契约测试通过,也不能由单次交互推出资源生命周期或跨步骤业务行为正确。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      It is important to note that contract testing is not the same as saying that an API conforms to a schema. A system is either compatible with a schema (like OpenAPI Spec) or it is not; a contract is about a defined interaction between parties and provides examples.

    参考来源

    - 位置:《Mastering API Architecture》第2章《Testing APIs》之《Why Contract Testing Is Often Preferable》(源文件:_epub-src/OEBPS/ch02.xhtml) - 结论依据:原文明确区分 schema 兼容与当事方约定的交互,下一节又提醒多步骤场景应交给组件测试。 - 原始内容:It is important to note that contract testing is not the same as saying that an API conforms to a schema. A system is either compatible with a schema (like OpenAPI Spec) or it is not; a contract is about a defined interaction between parties and provides examples.