Generate swagger docs
Some checks failed
Client CMS Check Build (NixCN CMS) TeamCity build finished
Backend Check Build (NixCN CMS) TeamCity build failed

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-29 00:59:49 +08:00
parent 330b037dca
commit 732d9866db
3 changed files with 1563 additions and 301 deletions

View File

@@ -46,27 +46,75 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successful exchange",
"schema": {
"$ref": "#/definitions/service_auth.ExchangeResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_auth.ExchangeResult"
}
}
}
]
}
},
"400": {
"description": "Invalid Input",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -98,27 +146,75 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successful request",
"schema": {
"$ref": "#/definitions/service_auth.MagicResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_auth.MagicResult"
}
}
}
]
}
},
"400": {
"description": "Invalid Input",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Turnstile Verification Failed",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -131,6 +227,7 @@ const docTemplate = `{
"application/x-www-form-urlencoded"
],
"produces": [
"application/json",
"text/html"
],
"tags": [
@@ -176,19 +273,55 @@ const docTemplate = `{
"400": {
"description": "Invalid Input / Client Not Found / URI Mismatch",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Invalid or Expired Verification Code",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -220,27 +353,75 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successful rotation",
"schema": {
"$ref": "#/definitions/service_auth.RefreshResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_auth.TokenResponse"
}
}
}
]
}
},
"400": {
"description": "Invalid Input",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"401": {
"description": "Invalid Refresh Token",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -272,27 +453,75 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successful token issuance",
"schema": {
"$ref": "#/definitions/service_auth.TokenResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_auth.TokenResponse"
}
}
}
]
}
},
"400": {
"description": "Invalid Input",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Invalid or Expired Code",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -322,9 +551,57 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successfully generated code",
"schema": {
"$ref": "#/definitions/service_event.CheckinResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_event.CheckinResult"
}
}
}
]
}
},
"400": {
"description": "Invalid Input",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -354,9 +631,57 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Current attendance status",
"schema": {
"$ref": "#/definitions/service_event.CheckinQueryResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_event.CheckinQueryResult"
}
}
}
]
}
},
"400": {
"description": "Invalid Input",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"404": {
"description": "Record Not Found",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -388,9 +713,39 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Attendance marked successfully",
"schema": {
"$ref": "#/definitions/service_event.CheckinSubmitResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"400": {
"description": "Invalid Code or Input",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -420,27 +775,75 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successful retrieval",
"schema": {
"$ref": "#/definitions/service_event.InfoResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_event.InfoResult"
}
}
}
]
}
},
"400": {
"description": "Invalid Input",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"404": {
"description": "Event Not Found",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -466,15 +869,39 @@ const docTemplate = `{
"summary": "Get Full User Table",
"responses": {
"200": {
"description": "OK",
"description": "Successful retrieval of full user table",
"schema": {
"$ref": "#/definitions/service_user.UserTableResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_user.UserTableResult"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error (Database Error)",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -500,27 +927,75 @@ const docTemplate = `{
"summary": "Get My User Information",
"responses": {
"200": {
"description": "OK",
"description": "Successful profile retrieval",
"schema": {
"$ref": "#/definitions/service_user.UserInfoResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/service_user.UserInfoData"
}
}
}
]
}
},
"403": {
"description": "Missing User ID / Unauthorized",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"404": {
"description": "User Not Found",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error (UUID Parse Failed)",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -528,7 +1003,7 @@ const docTemplate = `{
},
"/user/list": {
"get": {
"description": "Fetches a list of users with support for pagination via limit and offset.",
"description": "Fetches a list of users with support for pagination via limit and offset. Data is sourced from the search engine for high performance.",
"consumes": [
"application/json"
],
@@ -556,21 +1031,60 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successful paginated list retrieval",
"schema": {
"$ref": "#/definitions/service_user.UserListResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/data.UserSearchDoc"
}
}
}
}
]
}
},
"400": {
"description": "Invalid Input (Format Error)",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error (Search Engine or Missing Offset)",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -607,27 +1121,75 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "Successful profile update",
"schema": {
"$ref": "#/definitions/service_user.UserInfoResult"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"400": {
"description": "Invalid Input (Validation Failed)",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Missing User ID / Unauthorized",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error (Database Error / UUID Parse Failed)",
"schema": {
"type": "string"
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
@@ -793,17 +1355,6 @@ const docTemplate = `{
}
}
},
"service_auth.RefreshResult": {
"type": "object",
"properties": {
"common": {
"$ref": "#/definitions/shared.CommonResult"
},
"data": {
"$ref": "#/definitions/service_auth.TokenResponse"
}
}
},
"service_auth.TokenData": {
"type": "object",
"properties": {
@@ -823,17 +1374,6 @@ const docTemplate = `{
}
}
},
"service_auth.TokenResult": {
"type": "object",
"properties": {
"common": {
"$ref": "#/definitions/shared.CommonResult"
},
"data": {
"$ref": "#/definitions/service_auth.TokenResponse"
}
}
},
"service_event.CheckinQueryResult": {
"type": "object",
"properties": {
@@ -874,14 +1414,6 @@ const docTemplate = `{
}
}
},
"service_event.CheckinSubmitResult": {
"type": "object",
"properties": {
"common": {
"$ref": "#/definitions/shared.CommonResult"
}
}
},
"service_event.InfoResult": {
"type": "object",
"properties": {
@@ -936,31 +1468,6 @@ const docTemplate = `{
}
}
},
"service_user.UserInfoResult": {
"type": "object",
"properties": {
"common": {
"$ref": "#/definitions/shared.CommonResult"
},
"data": {
"$ref": "#/definitions/service_user.UserInfoData"
}
}
},
"service_user.UserListResult": {
"type": "object",
"properties": {
"common": {
"$ref": "#/definitions/shared.CommonResult"
},
"user_list": {
"type": "array",
"items": {
"$ref": "#/definitions/data.UserSearchDoc"
}
}
}
},
"service_user.UserTableResult": {
"type": "object",
"properties": {
@@ -985,6 +1492,21 @@ const docTemplate = `{
"type": "integer"
}
}
},
"utils.RespStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {},
"error_id": {
"type": "string"
},
"status": {
"type": "string"
}
}
}
}
}`