知识卡片
同时验证输入和输出
输入验证检查调用是否满足承诺,输出验证检查实现是否给了消费者承诺的数据和状态。可用契约代理观察真实服务的响应,既验证正常样本,也验证故意写错的字段能被报告。[[共享模式避免约束漂移]]
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Building a backend with Node.js and Swagger Codegen 13.5 Running and testing the backend · 查看原书依据
Input validation is an extremely important feature, because input to a software system is never trustworthy as it is outside the developer’s influence. For an API, however, output validation is equally important. The OpenAPI definition is a contract that specifies inputs and
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第13章《Building a backend with Node.js and Swagger Codegen》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch13.htm,阅读块 145)
- 结论依据:原文指出输入校验以外还要验证消费者收到的实际响应。
- 原始内容:Input validation is an extremely important feature, because input to a software system is never trustworthy as it is outside the developer’s influence. For an API, however, output validation is equally important. The OpenAPI definition is a contract that specifies inputs and