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

View File

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

View File

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

View File

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