Define a response object with an array in YAML using Swagger Editor
我正在使用YAML在Swagger编辑器中进行API定义。我试图代表以下响应正文:
1 2 3 4 | { success: true, ids: [123456, ...] } |
这是我的YAML外观:
1 2 3 4 5 6 7 8 9 10 11 12 | definitions: SuccessfulResponse: type: object properties: success: type: boolean description: True if the all operations were successful ids: type: array items: id: type: string |
我尝试了几种不同的方法,但是像这样,但是似乎没有任何有效的方法
如何正确描述上面给出的返回对象?
以下是将属性定义为字符串数组的示例:
1 2 3 4 | 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