知识卡片
UUID格式与粗筛
UUID 文本常分为 8-4-4-4-12 五段。只检查允许字符和总长度可以拒绝明显错误,仍可能接纳连字符位置不对或版本位不对的字符串。先确定契约需要粗筛、格式验证还是版本保证。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Describing API responses 5.7 Describing the GET /reviews response · 查看原书依据
To limit our schema to match this type of string, we’re going to add a crude regular expression that reads “36 characters composed of hexadecimals and dashes.” We don’t need to be more specific than that in this case.
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第05章《Describing API responses》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch05.htm,阅读块 167)
- 结论依据:原文说明示例表达式仅限定十六进制与连字符组成的 36 字符。
- 原始内容:To limit our schema to match this type of string, we’re going to add a crude regular expression that reads “36 characters composed of hexadecimals and dashes.” We don’t need to be more specific than that in this case.