support for multiple routing response docs

This commit is contained in:
cuisaihang
2022-10-11 18:18:20 +08:00
parent 3ff75d22a5
commit dc7397c7c2
6 changed files with 98 additions and 3 deletions

View File

@ -36,6 +36,11 @@ type (
UserSearchReq {
KeyWord string `form:"keyWord"` // 关键词
}
ErrorResponse {
Code string `json:"code"`
Message string `json:"message"`
}
)
@server(
@ -59,6 +64,13 @@ service user-api {
summary: 获取用户信息
)
@handler getUserInfo
/*
@respdoc-400 (
100101: out of authority
100102: user not exist
) // Error code list
*/
/* @respdoc-500 (ErrorResponse) // Server Error */
get /user/:id (UserInfoReq) returns (UserInfoReply)
@doc(

View File

@ -103,6 +103,18 @@
"schema": {
"$ref": "#/definitions/UserInfoReply"
}
},
"400": {
"description": "Error code list",
"schema": {
"example": "{\"100101\":\"out of authority\",\"100102\":\"user not exist\"}"
}
},
"500": {
"description": "Server Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"parameters": [
@ -120,6 +132,22 @@
}
},
"definitions": {
"ErrorResponse": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"title": "ErrorResponse",
"required": [
"code",
"message"
]
},
"LoginReq": {
"type": "object",
"properties": {