使用 Swagger Editor 在 YAML 中使用数组定义响应对象

Define a response object with an array in YAML using Swagger Editor

我正在使用 YAML 在 Swagger 编辑器中处理 API 定义。我正在尝试表示以下响应正文:

{
    success: true,
    ids: [123456, ...]
}

这就是我的 YAML 的样子:

definitions:
  SuccessfulResponse:
    type: object 
    properties:
      success:
        type: boolean
        description: True if the all operations were successful
      ids:
        type: array
        items: 
          id: 
          type: string 

我尝试了几种不同的方法,但像这样,但似乎没有什么有效的

如何正确描述上面给出的 return 对象?

下面是一个将 属性 定义为字符串数组的示例:

  photoUrls:
    type: array
    items:
      type: string

参考:https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml#L661-L667