整数列表或整数数组的Swagger 2,0查询参数语法

问题描述 投票:1回答:1

我一直在费劲地阅读文档,并试图使用swagger成功地通过列表或整数数组,因为我正在尝试测试API。

[我正在尝试通过这样的teamID列表:(请注意,我一直在尝试各种变体,但是调试时值仍然没有通过]

 {
"type": "array",
    "items": {
        "type": "integer",
        "enum": [
            1,
            2,
            3
        ]
   }

我使用“枚举”,因为它是我尝试传递的值列表。

这里也是我的招摇方法的屏幕截图:

enter image description here

api swagger query-parameters
1个回答
0
投票

作为整数数组的查询参数定义如下:

{
  "in: query",
  "name": "teamIDs",
  "type": "array",
  "items": {
    "type": "integer"
  }
}

在您的Swagger UI中,输入teamIDs参数的值每行一个],如下所示:

1
2
3
© www.soinside.com 2019 - 2024. All rights reserved.