Skip to content

Commit

Permalink
Fix lint-swagger warning (#29787)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sillyguodong authored Mar 14, 2024
1 parent eb8c34f commit 2033eb7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
7 changes: 0 additions & 7 deletions modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,3 @@ type UserBadgeOption struct {
// example: ["badge1","badge2"]
BadgeSlugs []string `json:"badge_slugs" binding:"Required"`
}

// BadgeList
// swagger:response BadgeList
type BadgeList struct {
// in:body
Body []Badge `json:"body"`
}
3 changes: 0 additions & 3 deletions routers/api/v1/swagger/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,4 @@ type swaggerParameterBodies struct {

// in:body
UserBadgeOption api.UserBadgeOption

// in:body
UserBadgeList api.BadgeList
}
7 changes: 7 additions & 0 deletions routers/api/v1/swagger/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ type swaggerResponseUserSettings struct {
// in:body
Body []api.UserSettings `json:"body"`
}

// BadgeList
// swagger:response BadgeList
type swaggerResponseBadgeList struct {
// in:body
Body []api.Badge `json:"body"`
}
17 changes: 1 addition & 16 deletions templates/swagger/v1_json.tmpl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2033eb7

Please sign in to comment.