【发布时间】:2017-11-21 19:02:25
【问题描述】:
我在 swagger.yml 中有以下服务。编写服务以便 page_id 可以多次传递。例如/pages?page_id[]=123&page_id[]=542
我检查了此链接https://swagger.io/specification/,但无法理解如何更新 yml,以便可以多次传递 id。
我看到我必须设置collectionFormat,但不知道如何设置。
我尝试像下面这样更新它,但没有运气https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md。
它生成像'http://localhost:0000/pages?page_id=123%2C%20542`这样的url
'/pages':
get:
tags:
-
summary: get the list of pages
operationId: getPages
produces:
- application/json
parameters:
- name: page_id
in: query
description: some description
required: false
type: string
collectionFormat: multi
- name: page_detail
in: query
description: some description
required: false
type: string
responses:
'200':
description: OK
'401':
description: Authentication Failed
'404':
description: Not Found
'503':
description: Service Not Available
【问题讨论】: