diff --git a/models/issue_reaction.go b/models/issue_reaction.go index 6a3dfe9f40ad3..d14ec5a83ae9b 100644 --- a/models/issue_reaction.go +++ b/models/issue_reaction.go @@ -274,5 +274,5 @@ func (list ReactionList) APIFormat() api.CommentReactionList { Count: counts[k], }) } - return result + return api.CommentReactionList{CommentReactions: result} } diff --git a/modules/structs/issue_comment.go b/modules/structs/issue_comment.go index c6617354a1418..a5a3ef40314de 100644 --- a/modules/structs/issue_comment.go +++ b/modules/structs/issue_comment.go @@ -46,4 +46,6 @@ type CommentReaction struct { } // CommentReactionList is a list of comment reactions -type CommentReactionList []*CommentReaction +type CommentReactionList struct { + CommentReactions []*CommentReaction `json:"comment_reactions" binding:"Required"` +} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index fac64a04c4e06..62cd2b1c50865 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -7807,9 +7807,15 @@ }, "CommentReactionList": { "description": "CommentReactionList is a list of comment reactions", - "type": "array", - "items": { - "$ref": "#/definitions/CommentReaction" + "type": "object", + "properties": { + "comment_reactions": { + "type": "array", + "items": { + "$ref": "#/definitions/CommentReaction" + }, + "x-go-name": "CommentReactions" + } }, "x-go-package": "code.gitea.io/gitea/modules/structs" },