fix(swagger): correct type names in swagger docs

Rename icon-related types in swagger docs:
- homepage.FetchResult → iconfetch.Result
- homepage.IconMetaSearch → iconlist.IconMetaSearch
- homepage.IconSource → icons.Source
- Shorten enum varnames (IconSourceAbsolute → SourceAbsolute, etc.)
- Add x-nullable: true to rules arrays
This commit is contained in:
yusing
2026-01-10 15:57:56 +08:00
parent bc44de3196
commit aaa3c9a8d8
4 changed files with 26 additions and 26 deletions

View File

@@ -811,7 +811,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/homepage.FetchResult"
"$ref": "#/definitions/iconfetch.Result"
}
}
},
@@ -1698,7 +1698,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/homepage.IconMetaSearch"
"$ref": "#/definitions/iconlist.IconMetaSearch"
}
}
},
@@ -4335,8 +4335,7 @@
"items": {
"$ref": "#/definitions/rules.Rule"
},
"x-nullable": false,
"x-omitempty": false
"x-nullable": true
},
"scheme": {
"type": "string",
@@ -5202,7 +5201,7 @@
"x-nullable": false,
"x-omitempty": false
},
"homepage.FetchResult": {
"iconfetch.Result": {
"type": "object",
"properties": {
"icon": {
@@ -5223,7 +5222,7 @@
"x-nullable": false,
"x-omitempty": false
},
"homepage.IconMetaSearch": {
"iconlist.IconMetaSearch": {
"type": "object",
"properties": {
"Dark": {
@@ -5252,7 +5251,7 @@
"x-omitempty": false
},
"Source": {
"$ref": "#/definitions/homepage.IconSource",
"$ref": "#/definitions/icons.Source",
"x-nullable": false,
"x-omitempty": false
},
@@ -5265,7 +5264,7 @@
"x-nullable": false,
"x-omitempty": false
},
"homepage.IconSource": {
"icons.Source": {
"type": "string",
"enum": [
"https://",
@@ -5274,10 +5273,10 @@
"@selfhst"
],
"x-enum-varnames": [
"IconSourceAbsolute",
"IconSourceRelative",
"IconSourceWalkXCode",
"IconSourceSelfhSt"
"SourceAbsolute",
"SourceRelative",
"SourceWalkXCode",
"SourceSelfhSt"
],
"x-nullable": false,
"x-omitempty": false
@@ -5515,8 +5514,7 @@
"items": {
"$ref": "#/definitions/rules.Rule"
},
"x-nullable": false,
"x-omitempty": false
"x-nullable": true
},
"scheme": {
"type": "string",

View File

@@ -959,6 +959,7 @@ definitions:
items:
$ref: '#/definitions/rules.Rule'
type: array
x-nullable: true
scheme:
enum:
- http
@@ -1428,7 +1429,7 @@ definitions:
required:
- id
type: object
homepage.FetchResult:
iconfetch.Result:
properties:
icon:
items:
@@ -1438,7 +1439,7 @@ definitions:
statusCode:
type: integer
type: object
homepage.IconMetaSearch:
iconlist.IconMetaSearch:
properties:
Dark:
type: boolean
@@ -1451,11 +1452,11 @@ definitions:
SVG:
type: boolean
Source:
$ref: '#/definitions/homepage.IconSource'
$ref: '#/definitions/icons.Source'
WebP:
type: boolean
type: object
homepage.IconSource:
icons.Source:
enum:
- https://
- '@target'
@@ -1463,10 +1464,10 @@ definitions:
- '@selfhst'
type: string
x-enum-varnames:
- IconSourceAbsolute
- IconSourceRelative
- IconSourceWalkXCode
- IconSourceSelfhSt
- SourceAbsolute
- SourceRelative
- SourceWalkXCode
- SourceSelfhSt
mem.VirtualMemoryStat:
properties:
available:
@@ -1594,6 +1595,7 @@ definitions:
items:
$ref: '#/definitions/rules.Rule'
type: array
x-nullable: true
scheme:
enum:
- http
@@ -2229,7 +2231,7 @@ paths:
description: OK
schema:
items:
$ref: '#/definitions/homepage.FetchResult'
$ref: '#/definitions/iconfetch.Result'
type: array
"400":
description: 'Bad Request: alias is empty or route is not HTTPRoute'
@@ -2811,7 +2813,7 @@ paths:
description: OK
schema:
items:
$ref: '#/definitions/homepage.IconMetaSearch'
$ref: '#/definitions/iconlist.IconMetaSearch'
type: array
"400":
description: Bad Request

View File

@@ -28,7 +28,7 @@ type GetFavIconRequest struct {
// @Produce image/svg+xml,image/x-icon,image/png,image/webp
// @Param url query string false "URL of the route"
// @Param alias query string false "Alias of the route"
// @Success 200 {array} homepage.FetchResult
// @Success 200 {array} iconfetch.Result
// @Failure 400 {object} apitypes.ErrorResponse "Bad Request: alias is empty or route is not HTTPRoute"
// @Failure 403 {object} apitypes.ErrorResponse "Forbidden: unauthorized"
// @Failure 404 {object} apitypes.ErrorResponse "Not Found: route or icon not found"

View File

@@ -22,7 +22,7 @@ type ListIconsRequest struct {
// @Produce json
// @Param limit query int false "Limit"
// @Param keyword query string false "Keyword"
// @Success 200 {array} homepage.IconMetaSearch
// @Success 200 {array} iconlist.IconMetaSearch
// @Failure 400 {object} apitypes.ErrorResponse
// @Failure 403 {object} apitypes.ErrorResponse
// @Router /icons [get]