知识卡片
API规范约束两端
API 规范描述调用方式和预期响应,成为服务端与客户端共同遵循的契约。双方都按规范实现,集成才有可检验的共同基准。契约清晰有助于对齐预期,但仍需用实际请求验证实现是否遵守规范,参见 [[文档驱动开发]]。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 1 章《What are microservice APIs?》(源文件:_epub-src/OEBPS/Text/01.htm)
- 结论依据:1.2.3 节明确说明文档列出交互要求和响应,并把它定义为服务间契约;只有客户端、服务端都遵循规范,集成才会按预期工作。
- 原始内容:The API documentation tells us exactly what we need to do to interact with the microservice and what kind of responses we can expect from it. ... API documentation represents a contract between services: as long as both the client and the server follow the API documentation, communication will work as expected.