Set an example for a @Failure annotation for Swaggo

Viewed 589

I'm using Swaggo to do the documentation of my API and I'm strugling to add an example for the results of the requests (more precisely, Failure ones).

Here's my code of one path:

// @Summary Modification of a leave
// @Description Modification of a leave
// @Tags Leave
// @Accept  json
// @Produce  plain
// @Param modifLeaveRequest body ModifLeaveRequest true "Request to modify a leave"
// @Param leave_id path int true "Leave ID"
// @Success 200 {boolean} boolean "true"
// @Failure 400 {string} string "error in the fields"
// @Failure 401 {string} string "wrong login"
// @Failure 409 {string} string "the leave cannot be modified"
// @Failure 500 {string} string "an error occurred during the modification"
// @Router /leave/{leave_id} [put]
func handlerModificationLeave(c *gin.Context) {
   //Do some stuff
}

And here the result in the Swagger documentation: Http status

What I want is to replace the Example value which is string by the actual error

Thank you very much for you help.

0 Answers
Related