如何为带有数组的application / x-www-form-urlencoded请求定义Swagger

问题描述

我有一个API,其卷曲请求如下:

curl --request POST \
  --url 'http://some.url/api/Resource/findByIds' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'data[ids][]=100025' \
  --data 'data[ids][]=100028'

这如何在OpenAPI(Swagger)请求定义和示例(版本3)中表示?

这是我到目前为止的内容,但是我似乎无法正确显示该示例。

    api/Resource/findByIds:
      post:
        summary: Find resource by IDs
        requestBody:
          content:
            application/x-www-form-urlencoded:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      ids:
                        type: array
                        description: IDs of resources to fetch
                        items:
                          type: integer
                encoding:
                  data:
                    style: deepObject
                    explode: true
              example:
                data:
                  ids: [2334,234,20043]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)