gpt4 book ai didi

swagger - 使用 Swagger 编辑器在 YAML 中定义一个带有数组的响应对象

转载 作者:行者123 更新时间:2023-12-03 23:33:28 24 4
gpt4 key购买 nike

我正在使用 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

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

enter image description here

我如何正确描述我上面给出的返回对象?

最佳答案

这是将属性定义为字符串数组的示例:

  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

关于swagger - 使用 Swagger 编辑器在 YAML 中定义一个带有数组的响应对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40458172/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com