swagger - JSON请求正文示例招摇
问题描述
有没有办法在 swagger 2.0 中为请求正文设置示例?
我的方案与https://petstore.swagger.io/中的相同
我的json参数:
"parameters": [
{
"in": "body",
"name": "body",
"description": "Pet object that needs to be added to the store",
"required": true,
"schema": {
"$ref": "#/definitions/Pet"
},
"x-example": "x-example": "{\r\n\"id\":123123123123123123,\r\n\"category\":{\r\n\"id\":44,\r\n\"name\":\"A12312312312312AA\"\r\n},\r\n\"name\":\"X123123123123XX\",\r\n\"photoUrls\":[\r\n\"st123123123ring\"\r\n],\r\n\"tags\":[\r\n{\r\n\"id\":0,\r\n\"name\":\"str123123ing\"\r\n}\r\n],\r\n\"status\":\"avai123123lable\"\r\n}""
}
],
我尝试了一切来设置我自己的例子。
x-example:
default/(application/json):
等等。没有结果。
解决方案
推荐阅读
- xamarin - Xamarin 更改列表视图中标签的文本和颜色
- matlab - 如何在matlab中设置子图的位置
- mysql - MySQL中RAND()的工作流程?
- gradle - 无法配置 Gradle 项目(Kotlin 代码)
- loops - 从多个变量中提取字符串的循环
- installation - 如何升级到 Dart 2?
- python - 由于安装错误,无法安装 py-audio
- git - Specify default pull branch for a given remote
- ios - 如何在 Xcode 中删除签名证书?
- angular - FormGroup CustomFilter 中的 Mat-AutoComplete