【发布时间】:2023-03-26 16:30:01
【问题描述】:
目前我正在尝试为我的软件创建一个 swagger 文件。 现在我想为 timeRange 创建一个定义。 我的问题是这个数组看起来像这样:
timeRange: {
"2016-01-15T09:00:00.000Z", // this is the start date
"2017-01-15T09:00:00.000Z" // this is the end date
}
如何创建开箱即用的示例值? 它是一个至少有两个的“字符串数组”。
"timeRange": {
"type": "array",
"items": {
"type": "string",
"example": "2017-01-15T09:00:00.000Z,2017-01-15T09:00:00.000Z"
}
}
这会生成一个这样的示例:
"timeRange": [
"2017-01-15T09:00:00.000Z,2017-01-15T09:00:00.000Z"
]
这个例子不起作用,因为它是一个数组而不是一个对象。 全部一起: 如何实现一个存在于两个不同字符串(没有名称)中的示例值。
希望你能帮助我! 干杯!
【问题讨论】:
标签: arrays api documentation swagger swagger-ui