知识卡片
参数声明标明位置与约束
OpenAPI 参数定义要写名称、所在位置、是否必填以及 schema 类型。in: query 表示查询参数,in: path 表示 URL 路径参数;前者可用于过滤,后者常用于定位资源。接口调用方据此知道值该放哪里以及如何编码。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 5 章《Documenting REST APIs with OpenAPI》(源文件:_epub-src/OEBPS/Text/05.htm)
- 结论依据:原文在 GET /orders 参数示例中逐项说明 name、in、required、schema,并区分 path 与 query 的用途。
- 原始内容:The definition of a parameter requires a name , which is the value we use to refer to it in the actual URL. We also specify what type of parameter it is. ... Path parameters are part of the URL path and are typically used to identify a resource. ... We define the parameter’s type using the schema keyword