知识卡片
整数范围与整倍数组合
整数类型与上下界、multipleOf 分别表达类型、值域和间隔。要允许 4、6 到 18,则排除 2 与 20 并要求整倍数 2。3.0 和 3.1 的排他界写法不同,迁移时核对方言。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Improving input validation with advanced JSON Schema 19.2 Supported validations · 查看原书依据
As an example, the following listing shows a schema with an integer field named my_number, which can contain anything between 2 and 20 (but not these exact numbers) that is a multiple of 2 (in other words, an even number).
参考来源
- 位置:《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,阅读块 43)
- 结论依据:书中用严格位于 2 和 20 之间的偶数解释多个约束并用。
- 原始内容:As an example, the following listing shows a schema with an integer field named my_number, which can contain anything between 2 and 20 (but not these exact numbers) that is a multiple of 2 (in other words, an even number).