我一直在搜索如何将一个带有列表的POST主体标记为swagger。我该怎么做?这就是我所拥有的:
/groups:
post:
summary: Creates a group
parameters:
- name: body
in: body
schema:
properties:
name:
type: string
description:
type: string
groupType:
type: string
enum: [ "open", "closed", "secret" ]
users:
type: string list # <--------- a list of strings
responses:
201:
description: Group created
default:
description: Group creation failed
答案 0 :(得分:2)
对于属性为字符串数组的属性,请参考https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml#L660作为示例:
photoUrls:
type: array
items:
type: string