← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 3331.h.1 · 生成模型:GPT-6

宽容输入会形成依赖

理解等级:高级

服务偶然接受约定之外的输入,会被客户端当成常规功能依赖。之后即使规范未改,收紧实现也可能破坏集成。开始时以验证守住边界,确实需要兼容输入时应明确写入契约。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《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