fix(api): align Swagger schemas for UserSettings and TopicListResponse (#38590)

Corrects the Swagger/OpenAPI schemas for `/user/settings` and
`/topics/search` to match the actual JSON objects returned by the API.

Signed-off-by: Sudhanshu Singh <sudhanshuwriterblc@gmail.com>
This commit is contained in:
Shudhanshu Singh
2026-07-23 14:49:52 +08:00
committed by GitHub
parent 20221e1faa
commit 560edd45e9
6 changed files with 41 additions and 20 deletions
+5
View File
@@ -32,3 +32,8 @@ type RepoTopicOptions struct {
// list of topic names // list of topic names
Topics []string `json:"topics"` Topics []string `json:"topics"`
} }
// TopicListResponse returns a list of TopicResponse
type TopicListResponse struct {
Topics []*TopicResponse `json:"topics"`
}
+2 -2
View File
@@ -300,7 +300,7 @@ func TopicSearch(ctx *context.APIContext) {
} }
ctx.SetTotalCountHeader(total) ctx.SetTotalCountHeader(total)
ctx.JSON(http.StatusOK, map[string]any{ ctx.JSON(http.StatusOK, api.TopicListResponse{
"topics": topicResponses, Topics: topicResponses,
}) })
} }
+1 -1
View File
@@ -341,7 +341,7 @@ type swaggerFileDeleteResponse struct {
// swagger:response TopicListResponse // swagger:response TopicListResponse
type swaggerTopicListResponse struct { type swaggerTopicListResponse struct {
// in: body // in: body
Body []api.TopicResponse `json:"body"` Body api.TopicListResponse `json:"body"`
} }
// TopicNames // TopicNames
+1 -1
View File
@@ -46,7 +46,7 @@ type swaggerResponseUserHeatmapData struct {
// swagger:response UserSettings // swagger:response UserSettings
type swaggerResponseUserSettings struct { type swaggerResponseUserSettings struct {
// in:body // in:body
Body []api.UserSettings `json:"body"` Body api.UserSettings `json:"body"`
} }
// BadgeList // BadgeList
+16 -8
View File
@@ -30208,6 +30208,20 @@
}, },
"x-go-package": "gitea.dev/modules/structs" "x-go-package": "gitea.dev/modules/structs"
}, },
"TopicListResponse": {
"description": "TopicListResponse returns a list of TopicResponse",
"type": "object",
"properties": {
"topics": {
"type": "array",
"items": {
"$ref": "#/definitions/TopicResponse"
},
"x-go-name": "Topics"
}
},
"x-go-package": "gitea.dev/modules/structs"
},
"TopicName": { "TopicName": {
"description": "TopicName a list of repo topic names", "description": "TopicName a list of repo topic names",
"type": "object", "type": "object",
@@ -31804,10 +31818,7 @@
"TopicListResponse": { "TopicListResponse": {
"description": "TopicListResponse", "description": "TopicListResponse",
"schema": { "schema": {
"type": "array", "$ref": "#/definitions/TopicListResponse"
"items": {
"$ref": "#/definitions/TopicResponse"
}
} }
}, },
"TopicNames": { "TopicNames": {
@@ -31858,10 +31869,7 @@
"UserSettings": { "UserSettings": {
"description": "UserSettings", "description": "UserSettings",
"schema": { "schema": {
"type": "array", "$ref": "#/definitions/UserSettings"
"items": {
"$ref": "#/definitions/UserSettings"
}
} }
}, },
"VariableList": { "VariableList": {
+16 -8
View File
@@ -1402,10 +1402,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"items": { "$ref": "#/components/schemas/TopicListResponse"
"$ref": "#/components/schemas/TopicResponse"
},
"type": "array"
} }
} }
}, },
@@ -1484,10 +1481,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"items": { "$ref": "#/components/schemas/UserSettings"
"$ref": "#/components/schemas/UserSettings"
},
"type": "array"
} }
} }
}, },
@@ -9963,6 +9957,20 @@
"type": "object", "type": "object",
"x-go-package": "gitea.dev/modules/structs" "x-go-package": "gitea.dev/modules/structs"
}, },
"TopicListResponse": {
"description": "TopicListResponse returns a list of TopicResponse",
"properties": {
"topics": {
"items": {
"$ref": "#/components/schemas/TopicResponse"
},
"type": "array",
"x-go-name": "Topics"
}
},
"type": "object",
"x-go-package": "gitea.dev/modules/structs"
},
"TopicName": { "TopicName": {
"description": "TopicName a list of repo topic names", "description": "TopicName a list of repo topic names",
"properties": { "properties": {