From 7ed6c53f6b8be7092b5067c5e3bccb908da2272e Mon Sep 17 00:00:00 2001 From: yusing Date: Fri, 16 Jan 2026 12:26:14 +0800 Subject: [PATCH] fix(swagger): explicit set type names for IconFetchResult and IconMetaSearch --- internal/api/v1/docs/swagger.json | 132 ++++++++++----------- internal/api/v1/docs/swagger.yaml | 65 +++++----- internal/homepage/icons/fetch/fetch.go | 2 +- internal/homepage/icons/list/list_icons.go | 2 +- 4 files changed, 101 insertions(+), 100 deletions(-) diff --git a/internal/api/v1/docs/swagger.json b/internal/api/v1/docs/swagger.json index 7683bffa..8b7af2e0 100644 --- a/internal/api/v1/docs/swagger.json +++ b/internal/api/v1/docs/swagger.json @@ -811,7 +811,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/iconfetch.Result" + "$ref": "#/definitions/IconFetchResult" } } }, @@ -1698,7 +1698,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/iconlist.IconMetaSearch" + "$ref": "#/definitions/IconMetaSearch" } } }, @@ -3423,6 +3423,69 @@ "x-nullable": false, "x-omitempty": false }, + "IconFetchResult": { + "type": "object", + "properties": { + "icon": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + }, + "x-nullable": false, + "x-omitempty": false + }, + "statusCode": { + "type": "integer", + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, + "IconMetaSearch": { + "type": "object", + "properties": { + "Dark": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "Light": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "PNG": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "Ref": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "SVG": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "Source": { + "$ref": "#/definitions/icons.Source", + "x-nullable": false, + "x-omitempty": false + }, + "WebP": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, "IdlewatcherConfig": { "type": "object", "properties": { @@ -3440,7 +3503,7 @@ "x-omitempty": false }, "idle_timeout": { - "description": "0: no idle watcher.\nPositive: idle watcher with idle timeout.\nNegative: idle watcher as a dependency.\tIdleTimeout time.Duration `json:\"idle_timeout\" json_ext:\"duration\"`", + "description": "0: no idle watcher.\nPositive: idle watcher with idle timeout.\nNegative: idle watcher as a dependency.", "allOf": [ { "$ref": "#/definitions/time.Duration" @@ -5201,69 +5264,6 @@ "x-nullable": false, "x-omitempty": false }, - "iconfetch.Result": { - "type": "object", - "properties": { - "icon": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - }, - "x-nullable": false, - "x-omitempty": false - }, - "statusCode": { - "type": "integer", - "x-nullable": false, - "x-omitempty": false - } - }, - "x-nullable": false, - "x-omitempty": false - }, - "iconlist.IconMetaSearch": { - "type": "object", - "properties": { - "Dark": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - }, - "Light": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - }, - "PNG": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - }, - "Ref": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "SVG": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - }, - "Source": { - "$ref": "#/definitions/icons.Source", - "x-nullable": false, - "x-omitempty": false - }, - "WebP": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - } - }, - "x-nullable": false, - "x-omitempty": false - }, "icons.Source": { "type": "string", "enum": [ diff --git a/internal/api/v1/docs/swagger.yaml b/internal/api/v1/docs/swagger.yaml index f6f692a0..37abfd5f 100644 --- a/internal/api/v1/docs/swagger.yaml +++ b/internal/api/v1/docs/swagger.yaml @@ -517,6 +517,33 @@ definitions: $ref: '#/definitions/HomepageItemConfig' type: object type: object + IconFetchResult: + properties: + icon: + items: + format: int32 + type: integer + type: array + statusCode: + type: integer + type: object + IconMetaSearch: + properties: + Dark: + type: boolean + Light: + type: boolean + PNG: + type: boolean + Ref: + type: string + SVG: + type: boolean + Source: + $ref: '#/definitions/icons.Source' + WebP: + type: boolean + type: object IdlewatcherConfig: properties: depends_on: @@ -528,9 +555,10 @@ definitions: idle_timeout: allOf: - $ref: '#/definitions/time.Duration' - description: "0: no idle watcher.\nPositive: idle watcher with idle timeout.\nNegative: - idle watcher as a dependency.\tIdleTimeout time.Duration `json:\"idle_timeout\" - json_ext:\"duration\"`" + description: |- + 0: no idle watcher. + Positive: idle watcher with idle timeout. + Negative: idle watcher as a dependency. no_loading_page: type: boolean proxmox: @@ -1429,33 +1457,6 @@ definitions: required: - id type: object - iconfetch.Result: - properties: - icon: - items: - format: int32 - type: integer - type: array - statusCode: - type: integer - type: object - iconlist.IconMetaSearch: - properties: - Dark: - type: boolean - Light: - type: boolean - PNG: - type: boolean - Ref: - type: string - SVG: - type: boolean - Source: - $ref: '#/definitions/icons.Source' - WebP: - type: boolean - type: object icons.Source: enum: - https:// @@ -2231,7 +2232,7 @@ paths: description: OK schema: items: - $ref: '#/definitions/iconfetch.Result' + $ref: '#/definitions/IconFetchResult' type: array "400": description: 'Bad Request: alias is empty or route is not HTTPRoute' @@ -2813,7 +2814,7 @@ paths: description: OK schema: items: - $ref: '#/definitions/iconlist.IconMetaSearch' + $ref: '#/definitions/IconMetaSearch' type: array "400": description: Bad Request diff --git a/internal/homepage/icons/fetch/fetch.go b/internal/homepage/icons/fetch/fetch.go index 23fe03e6..40061445 100644 --- a/internal/homepage/icons/fetch/fetch.go +++ b/internal/homepage/icons/fetch/fetch.go @@ -29,7 +29,7 @@ type Result struct { StatusCode int contentType string -} +} // @name IconFetchResult func FetchResultWithErrorf(statusCode int, msgFmt string, args ...any) (Result, error) { return Result{StatusCode: statusCode}, fmt.Errorf(msgFmt, args...) diff --git a/internal/homepage/icons/list/list_icons.go b/internal/homepage/icons/list/list_icons.go index aa452618..36992596 100644 --- a/internal/homepage/icons/list/list_icons.go +++ b/internal/homepage/icons/list/list_icons.go @@ -31,7 +31,7 @@ type ( Ref string `json:"Ref"` rank int - } + } // @name IconMetaSearch ) const updateInterval = 2 * time.Hour