Skip to content

Commit 2033eb7

Browse files
authored
Fix lint-swagger warning (#29787)
Caused by: #23106 Fix: https://github.com/go-gitea/gitea/actions/runs/8274650046/job/22640335697 1. Delete `UserBadgeList` in `options.go`, because it wasn't used. (The struct defined in `options.go` is the struct used to parse the request body) 2. Move `BadgeList` struct under `routers/api/v1/swagger` folder which response should be defined in.
1 parent eb8c34f commit 2033eb7

File tree

4 files changed

+8
-26
lines changed

4 files changed

+8
-26
lines changed

modules/structs/user.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,3 @@ type UserBadgeOption struct {
132132
// example: ["badge1","badge2"]
133133
BadgeSlugs []string `json:"badge_slugs" binding:"Required"`
134134
}
135-
136-
// BadgeList
137-
// swagger:response BadgeList
138-
type BadgeList struct {
139-
// in:body
140-
Body []Badge `json:"body"`
141-
}

routers/api/v1/swagger/options.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,4 @@ type swaggerParameterBodies struct {
193193

194194
// in:body
195195
UserBadgeOption api.UserBadgeOption
196-
197-
// in:body
198-
UserBadgeList api.BadgeList
199196
}

routers/api/v1/swagger/user.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ type swaggerResponseUserSettings struct {
4848
// in:body
4949
Body []api.UserSettings `json:"body"`
5050
}
51+
52+
// BadgeList
53+
// swagger:response BadgeList
54+
type swaggerResponseBadgeList struct {
55+
// in:body
56+
Body []api.Badge `json:"body"`
57+
}

templates/swagger/v1_json.tmpl

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)