我正在使用Swagger-ui version 2.1.4,我已经在本地托管了它,并为它提供了我自己的Json文件和API,它可以很好地打开文档,但我想在响应消息中添加头部,但我不知道如何做到这一点,我遵循swagger specification来做,但不幸的是我仍然没有成功。我的示例代码在这里。
"responses" : {
"200" : {
"description" : "SUCCESSFULLY_RETRIVED",
"schema" : {
"$ref" : "#/definitions/Object"
}
},
"500" : {
"description" : "UNKNOWN_SERVER_ERROR",
"headers": {
"X-Rate-Limit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
}
}
},
"deprecated" : false
}发布于 2017-05-29 03:48:12
回复太晚了,但我在寻找类似需求的示例时偶然发现了这一点。你的东西应该可以工作,不确定为什么它不能为你工作。如果您提供了确切的错误,这将会有所帮助。
下面的yaml对我来说很好,你的也应该很好。
500:
description: Customer creation error
headers:
Error-Id:
description: the relevant 500 Error
type: stringhttps://stackoverflow.com/questions/35453863
复制相似问题