知识卡片
宽容输入会形成依赖
服务偶然接受约定之外的输入,会被客户端当成常规功能依赖。之后即使规范未改,收紧实现也可能破坏集成。开始时以验证守住边界,确实需要兼容输入时应明确写入契约。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Designing the next API iteration 15.4 Improving the developer experience · 查看原书依据
The second principle is Hyrum’s Law, which is the observation that any observed or accepted behavior of the system will be the de facto contract, and someone will probably depend on it. To follow our previous example, if the API’s contract says
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第15章《Designing the next API iteration》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch15.htm,阅读块 137)
- 结论依据:原文以未声明却接受整数为例说明 Hyrum 定律及变更风险。
- 原始内容:The second principle is Hyrum’s Law, which is the observation that any observed or accepted behavior of the system will be the de facto contract, and someone will probably depend on it. To follow our previous example, if the API’s contract says