feat swagger

This commit is contained in:
2026-01-12 13:49:57 +08:00
parent da26f9bbc9
commit 83d722d2f1
5 changed files with 42 additions and 229 deletions

View File

@@ -0,0 +1,273 @@
{
"swagger": "2.0",
"info": {
"title": "rs_common.proto",
"version": "version not set"
},
"tags": [
{
"name": "Gateway"
},
{
"name": "Scene"
},
{
"name": "User"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/user/answer_question": {
"post": {
"summary": "回答题目",
"operationId": "User_AnswerQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/AnswerQuestionResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AnswerQuestionReq"
}
}
],
"tags": [
"User"
]
}
},
"/user/generate_question": {
"post": {
"summary": "生成题目",
"operationId": "User_GenerateQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/GenerateQuestionResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GenerateQuestionReq"
}
}
],
"tags": [
"User"
]
}
},
"/user/get_question": {
"post": {
"summary": "获取题目",
"operationId": "User_GetQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/GetQuestionResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GetQuestionReq"
}
}
],
"tags": [
"User"
]
}
},
"/user/info": {
"post": {
"summary": "获取用户信息",
"operationId": "User_GetUserInfo",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/GetUserInfoResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GetUserInfoReq"
}
}
],
"tags": [
"User"
]
}
}
},
"definitions": {
"ActionResp": {
"type": "object"
},
"AnswerQuestionReq": {
"type": "object",
"properties": {
"sn": {
"type": "string",
"title": "题目唯一标识"
},
"answer": {
"type": "string",
"title": "答案"
}
},
"title": "---------- AnswerQuestion ----------"
},
"AnswerQuestionResp": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"title": "答案"
},
"explanation": {
"type": "string",
"title": "解析"
}
}
},
"EnterResp": {
"type": "object",
"properties": {
"SceneSID": {
"type": "string",
"title": "场景服务ID"
},
"UniqueNo": {
"type": "string",
"title": "副本唯一编号"
},
"MessageID": {
"type": "integer",
"format": "int32",
"title": "发送给客户端的消息ID"
},
"Payload": {
"type": "string",
"format": "byte",
"title": "消息负载"
}
}
},
"GenerateQuestionReq": {
"type": "object",
"properties": {
"num": {
"type": "integer",
"format": "int32",
"title": "生成数量"
},
"category": {
"type": "string",
"title": "题目类型"
}
},
"title": "---------- GenerateQuestion ----------"
},
"GenerateQuestionResp": {
"type": "object"
},
"GetQuestionReq": {
"type": "object",
"title": "---------- GetQuestion ----------"
},
"GetQuestionResp": {
"type": "object",
"properties": {
"sn": {
"type": "string",
"title": "题目唯一标识"
},
"question": {
"type": "string",
"title": "题干"
},
"options": {
"type": "array",
"items": {
"type": "string"
},
"title": "选项"
}
}
},
"GetUserInfoReq": {
"type": "object",
"properties": {
"usn": {
"type": "string"
}
},
"title": "---------- GetUserInfo ----------"
},
"GetUserInfoResp": {
"type": "object",
"properties": {
"usn": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"KickUserResp": {
"type": "object"
},
"LeaveResp": {
"type": "object"
},
"LoginResp": {
"type": "object",
"properties": {
"usn": {
"type": "string",
"title": "用户ID"
},
"name": {
"type": "string",
"title": "用户名"
}
}
},
"ToClientResp": {
"type": "object"
}
}
}