知识卡片
参数位置与模式分工
in: query 决定参数放在 URL 查询串,schema 规定值的类型和约束。maxRating 是数值,却仍要用上下界表达只接受 1 到 5。把一个规则仅写在文字描述里,机器无法凭数值类型推知范围。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Our first taste of OpenAPI definitions 3.5 Extending our first operation · 查看原书依据
Here we have our original fragment (from listing 3.6), and to it we have added a parameters field, which is an array of parameters. You may have noticed the dash (-) before the name field, which indicates an array item that is
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第03章《Our first taste of OpenAPI definitions》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch03.htm,阅读块 118)
- 结论依据:添加 maxRating 的例子将 name、description、in、schema 作为不同字段。
- 原始内容:Here we have our original fragment (from listing 3.6), and to it we have added a parameters field, which is an array of parameters. You may have noticed the dash (-) before the name field, which indicates an array item that is