知识卡片
模式共享的读写边界
用 readOnly 表明服务器提供的资源 ID,用 writeOnly 标记只接受的密码。OpenAPI 3.0 同时在 required 中列这样的字段时,要求只在相应方向生效。工具支持不等于授权或输出过滤实现,仍要验证实际数据边界。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Improving input validation with advanced JSON Schema 19.2 Supported validations · 查看原书依据
If you use an inline schema, which means you are specifying an object and its properties as part of the operation, you typically will not need readOnly. Inline schemas for responses are implicitly read-only and inline schemas for request bodies can drop
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第19章《Improving input validation with advanced JSON Schema》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch19.htm,阅读块 38)
- 结论依据:原文比较差异小时的方向标注及差异大时的分离模式。
- 原始内容:If you use an inline schema, which means you are specifying an object and its properties as part of the operation, you typically will not need readOnly. Inline schemas for responses are implicitly read-only and inline schemas for request bodies can drop