知识卡片
稳定接口支撑替换实现
服务的可替换性依赖稳定的对外接口:只要新实现仍遵守 API 契约,消费者就可按原方式调用并得到约定的响应。替换代码库与保持兼容是两回事;接口或响应语义变了,就不能仅凭部署成功宣称消费者无感。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 1 章《What are microservice APIs?》(源文件:_epub-src/OEBPS/Text/01.htm)
- 结论依据:1.2.3 节明确定义 replaceability 为完全替换端点后的代码库而端点通信仍工作,前提是新实现继续满足 API 文档与原有响应。
- 原始内容:APIs must be stable, and behind them you can change the internal implementations of any service provided they comply with the API documentation. This means that the consumer of an API must be able to continue calling the API in the exact way as before, and it must get the same responses.