这个问题在这里已有答案:
有没有办法在请求体中编写多行示例?如果可能的话,我希望我的OpenApi文档在Swagger-UI下运行时显示如下。
到目前为止,我所能实现的只是一个单行示例,如下所示:
你没有多说你的api选择语言或你如何产生你的swagger.json ......
但是有可能,以下是一些实例:
http://swashbuckletest.azurewebsites.net/swagger/ui/index?filter=Company#/Company/Company_Post
最后一个的json代码如下所示:
"delete": {
"tags": [
"Dictionary"
],
"operationId": "Dictionary_DeleteEcho",
"consumes": [
"application/json",
"text/json",
"text/html"
],
"produces": [
"application/json",
"text/json",
"text/html"
],
"parameters": [
{
"name": "guids",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"format": "uuid",
"type": "string",
"example": "00000000-0000-0000-0000-000000000000"
},
"example": [
"00000000-0000-0000-0000-000000000000",
"00000000-0000-0000-0000-000000000000"
]
}
}
],
...