【发布时间】:2021-08-24 20:56:49
【问题描述】:
我在 API 端点中有一个 multipart/form-data POST,它接受一些键/值字符串,并通过键 files 上传文件。
我相信我已经在 OpenAPI 中正确定义了它;
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"properties": {
"file": {
"type": "array",
"items": {
"type": "string",
"format": "binary"
}
},
"myKey1": {
"type": "string"
},
"myKey2": {
"type": "string"
}
}
},
"examples": {
"value": ?
}
}
}
},
但是,我不确定如何在 examples 字段中描述多部分/表单数据的示例。
我假设我不需要表示文件(尽管那将是一个奖励),而只需要表示 myKey1 和 myKey2 键和值。
【问题讨论】:
标签: schema multipartform-data openapi