fix(swagger): explicit set type names for IconFetchResult and IconMetaSearch

This commit is contained in:
yusing
2026-01-16 12:26:14 +08:00
parent 16c986978d
commit 4a652aaf55
4 changed files with 101 additions and 100 deletions

View File

@@ -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": [

View File

@@ -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

View File

@@ -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...)

View File

@@ -31,7 +31,7 @@ type (
Ref string `json:"Ref"`
rank int
}
} // @name IconMetaSearch
)
const updateInterval = 2 * time.Hour