对于这种格式的api:GET /resource?param=value1¶m=value2¶m=value3
在open Api 2.0中,我们可以这样指定:
parameters:
- in: query
name: color
type: array
collectionFormat: multi
items:
type: string
Run Code Online (Sandbox Code Playgroud)
但在 v3.0 中,属性 collectionFormat 不可用。因此,在尝试使用 collectionFormat 时,我收到错误消息 should not have additional property: collectionFormat。
我搜索了文档但找不到任何答案。有谁知道从 2.0 版本迁移到 3.0 版本的新实现应该是什么?
小智 7
您应该使用style和explode属性来代替:
- name: param
in: query
description: Id description
required: false
style: form
explode: true
schema:
type: array
items:
type: string
Run Code Online (Sandbox Code Playgroud)
在哪里
explode: true将形成 param=abc¶m=xyz 等explode: false将形成 param=abc,xyz参考:
collectionFormat(描述了property,在新版本规范中已被styleproperty取代)| 归档时间: |
|
| 查看次数: |
5053 次 |
| 最近记录: |