知识卡片

问题卡 · 519.d.4

接口变更保留旧路径

理解等级:高级

运行中的API需要改变参数、动作或业务限制时,应先判断能否保持现有消费者的调用承诺。

修改已发布接口时,不删除、不重定义、新增可选。新增搜索regions参数应有默认all,缺失时服务使用默认值;若新流程需要salesRep等必填输入,应增加独立动作并保留原processOrder。不可避免的破坏性修改应分叉新接口并安排新旧并行迁移,旧测试应继续检查兼容性;所有可观察行为都可能被使用者依赖。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体接口设计 · 查看原书依据

      Finally, any new things can be added as optional elements to the interface as long as they don’t take anything else away or redefine an existing item. If you come up with more input arguments, you can add those to the FORM, but you cannot make them required.

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第03章《超媒体接口设计》(来源项目 book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch03.xhtml;小节:3.11) - 结论依据:原文以修改已发布接口时,不删除、不重定义、新增可选的机制或场景为依据;同小节余文补充本卡所列条件,按2022年原书语境整理。 - 原始内容:Finally, any new things can be added as optional elements to the interface as long as they don’t take anything else away or redefine an existing item. If you come up with more input arguments, you can add those to the FORM, but you cannot make them required.