知识卡片
长度正则与格式
长度约束易读,正则适合结构模式,format 能表达 date-time、email 等约定或工具注解。三者分工不同。确认实际验证器会检查选定 format,尤其是工具自定义的类型标签。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Improving input validation with advanced JSON Schema 19.2 Supported validations · 查看原书依据
JSON Schema and OpenAPI provide the format keyword and a set of predefined formats with accessible, human-readable names, for common formats that you’ll need to validate in APIs. In chapter 17, for example, we used format: date-time to indicate that the string
参考来源
- 位置:《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,阅读块 52)
- 结论依据:正文列出具名格式,要求工具链可以理解。
- 原始内容:JSON Schema and OpenAPI provide the format keyword and a set of predefined formats with accessible, human-readable names, for common formats that you’ll need to validate in APIs. In chapter 17, for example, we used format: date-time to indicate that the string