From 193b0f3cd47972865164bddde2a41d2437fe9b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Wed, 26 Feb 2025 10:55:40 +0800 Subject: [PATCH] fix: Update swagger docs (#8002) Refs #8001 --- backend/app/api/v1/container.go | 2 +- cmd/server/docs/docs.go | 10 ++++++++-- cmd/server/docs/swagger.json | 10 ++++++++-- cmd/server/docs/swagger.yaml | 16 ++++++++++++++-- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/backend/app/api/v1/container.go b/backend/app/api/v1/container.go index 8272babc1..48ea1c066 100644 --- a/backend/app/api/v1/container.go +++ b/backend/app/api/v1/container.go @@ -391,7 +391,7 @@ func (b *BaseApi) ContainerOperation(c *gin.Context) { // @Tags Container // @Summary Container stats -// @Param id path integer true "container id" +// @Param id path string true "container id" // @Success 200 {object} dto.ContainerStats // @Security ApiKeyAuth // @Security Timestamp diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index c88f15d6e..c0033fa3c 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -3483,7 +3483,7 @@ const docTemplate = `{ "summary": "Container stats", "parameters": [ { - "type": "integer", + "type": "string", "description": "container id", "name": "id", "in": "path", @@ -19382,6 +19382,9 @@ const docTemplate = `{ "dto.ForwardRuleOperate": { "type": "object", "properties": { + "forceDelete": { + "type": "boolean" + }, "rules": { "type": "array", "items": { @@ -20708,6 +20711,9 @@ const docTemplate = `{ "dto.OllamaBindDomainRes": { "type": "object", "properties": { + "acmeAccountID": { + "type": "integer" + }, "allowIPs": { "type": "array", "items": { @@ -26721,7 +26727,7 @@ const docTemplate = `{ }, "securityDefinitions": { "ApiKeyAuth": { - "description": "- ` + "`" + `1Panel-Token` + "`" + ` is the key for the panel API Key.", + "description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n` + "`" + `` + "`" + `` + "`" + `\neg:\ncurl -X GET \"http://localhost:4004/api/v1/dashboard/current\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n` + "`" + `` + "`" + `` + "`" + `\n- ` + "`" + `1Panel-Token` + "`" + ` is the key for the panel API Key.", "type": "apiKey", "name": "1Panel-Token", "in": "header" diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index 5c8eb1311..1fe13c773 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -3480,7 +3480,7 @@ "summary": "Container stats", "parameters": [ { - "type": "integer", + "type": "string", "description": "container id", "name": "id", "in": "path", @@ -19379,6 +19379,9 @@ "dto.ForwardRuleOperate": { "type": "object", "properties": { + "forceDelete": { + "type": "boolean" + }, "rules": { "type": "array", "items": { @@ -20705,6 +20708,9 @@ "dto.OllamaBindDomainRes": { "type": "object", "properties": { + "acmeAccountID": { + "type": "integer" + }, "allowIPs": { "type": "array", "items": { @@ -26718,7 +26724,7 @@ }, "securityDefinitions": { "ApiKeyAuth": { - "description": "- `1Panel-Token` is the key for the panel API Key.", + "description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n```\neg:\ncurl -X GET \"http://localhost:4004/api/v1/dashboard/current\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n```\n- `1Panel-Token` is the key for the panel API Key.", "type": "apiKey", "name": "1Panel-Token", "in": "header" diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index 554bb6d9c..30650d8b9 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -1578,6 +1578,8 @@ definitions: type: object dto.ForwardRuleOperate: properties: + forceDelete: + type: boolean rules: items: properties: @@ -2480,6 +2482,8 @@ definitions: type: object dto.OllamaBindDomainRes: properties: + acmeAccountID: + type: integer allowIPs: items: type: string @@ -8585,7 +8589,7 @@ paths: in: path name: id required: true - type: integer + type: string responses: "200": description: OK @@ -16762,7 +16766,15 @@ schemes: - https securityDefinitions: ApiKeyAuth: - description: '- `1Panel-Token` is the key for the panel API Key.' + description: |- + Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp). + ``` + eg: + curl -X GET "http://localhost:4004/api/v1/dashboard/current" \ + -H "1Panel-Token: <1panel_token>" \ + -H "1Panel-Timestamp: " + ``` + - `1Panel-Token` is the key for the panel API Key. in: header name: 1Panel-Token type: apiKey