examples 属性来记录多个响应示例。
将此属性添加到任意响应中。它具有以下架构。
音频响应示例
audio/*,并提供音频文件的 URL 作为示例值。playground 显示的是交互式音频播放器,而不是代码片段。
为 API 端点记录多种响应变体。
examples 属性来记录多个响应示例。
将此属性添加到任意响应中。它具有以下架构。
responses:
"200":
description: 成功响应
content:
application/json:
schema:
$ref: "#/components/schemas/YourResponseSchema"
examples:
us:
summary: 美国的响应
value:
countryCode: "US"
currencyCode: "USD"
taxRate: 0.0825
gb:
summary: 英国的响应
value:
countryCode: "GB"
currencyCode: "GBP"
taxRate: 0.20
audio/*,并提供音频文件的 URL 作为示例值。playground 显示的是交互式音频播放器,而不是代码片段。
responses:
"200":
description: Audio file generated successfully
content:
audio/mpeg:
schema:
type: string
format: binary
examples:
sample:
summary: Sample audio output
value: "https://example.com/sample-audio.mp3"
此页面对您有帮助吗?