我想用 @ApiResponse 注释定义操作的“默认”响应。我正在使用 swagger annotations 1.5.x 并希望生成这样的东西(查看默认响应):
"get" : {
...
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Address"
}
}
},
"default" : {
"description" : "unsuccessful operation",
"schema" : {
"$ref" : "#/definitions/ErrorResponse"
}
}
},
...
}
Run Code Online (Sandbox Code Playgroud)
但我不知道该怎么做,因为 @ApiResponse(code = ...) 注释只需要数字而不是字符串。
我的Java代码:
...
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Address.class, responseContainer = "List"),
@ApiResponse(code = "default", …Run Code Online (Sandbox Code Playgroud)