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

@@ -1,10 +1,16 @@
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"title": "service_user.proto", "title": "rs_common.proto",
"version": "version not set" "version": "version not set"
}, },
"tags": [ "tags": [
{
"name": "Gateway"
},
{
"name": "Scene"
},
{ {
"name": "User" "name": "User"
} }
@@ -26,12 +32,6 @@
"schema": { "schema": {
"$ref": "#/definitions/AnswerQuestionResp" "$ref": "#/definitions/AnswerQuestionResp"
} }
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
} }
}, },
"parameters": [ "parameters": [
@@ -59,12 +59,6 @@
"schema": { "schema": {
"$ref": "#/definitions/GenerateQuestionResp" "$ref": "#/definitions/GenerateQuestionResp"
} }
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
} }
}, },
"parameters": [ "parameters": [
@@ -92,12 +86,6 @@
"schema": { "schema": {
"$ref": "#/definitions/GetQuestionResp" "$ref": "#/definitions/GetQuestionResp"
} }
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
} }
}, },
"parameters": [ "parameters": [
@@ -125,12 +113,6 @@
"schema": { "schema": {
"$ref": "#/definitions/GetUserInfoResp" "$ref": "#/definitions/GetUserInfoResp"
} }
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
} }
}, },
"parameters": [ "parameters": [
@@ -150,6 +132,9 @@
} }
}, },
"definitions": { "definitions": {
"ActionResp": {
"type": "object"
},
"AnswerQuestionReq": { "AnswerQuestionReq": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -177,6 +162,29 @@
} }
} }
}, },
"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": { "GenerateQuestionReq": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -239,6 +247,12 @@
} }
} }
}, },
"KickUserResp": {
"type": "object"
},
"LeaveResp": {
"type": "object"
},
"LoginResp": { "LoginResp": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -252,33 +266,8 @@
} }
} }
}, },
"protobufAny": { "ToClientResp": {
"type": "object", "type": "object"
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
} }
} }
} }

View File

@@ -1,44 +0,0 @@
{
"swagger": "2.0",
"info": {
"title": "rs_common.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

View File

@@ -1,55 +0,0 @@
{
"swagger": "2.0",
"info": {
"title": "service_gateway.proto",
"version": "version not set"
},
"tags": [
{
"name": "Gateway"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"KickUserResp": {
"type": "object"
},
"ToClientResp": {
"type": "object"
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

View File

@@ -1,78 +0,0 @@
{
"swagger": "2.0",
"info": {
"title": "service_scene.proto",
"version": "version not set"
},
"tags": [
{
"name": "Scene"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"ActionResp": {
"type": "object"
},
"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": "消息负载"
}
}
},
"LeaveResp": {
"type": "object"
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

View File

@@ -9,4 +9,5 @@ protoc `
--go-grpc_out=$gen ` --go-grpc_out=$gen `
--grpc-gateway_out=$gen ` --grpc-gateway_out=$gen `
--openapiv2_out=$gen ` --openapiv2_out=$gen `
--openapiv2_opt=allow_merge=true,merge_file_name=api,disable_default_errors=true `
$files $files