'How to hide swagger models at bottom with gin-swagger?

I am using gin-swagger for generating API document.

It shows Models at the bottom of the page list by default.

enter image description here

How to hide it?



Solution 1:[1]

I met the same issue before, I removed one annotation in comment and Models gone. But I could not remember the name of annotation, however, you can compare your annotaions with below and remove the additional one.

// @Summary Get all users
// @Description Get all users
// @Tags UserMgt
// @Accept  json
// @Produce  json
// @Param filter body object{UserFilter} true "filter"
// @Success 200  {array} object{models.User} "users"
// @Failure 400 {object} object{models.User} "users not found"
// @Router /user/all [post]
// @Security ApiKeyAuth
func GetAllUsers(ctx *gin.Context) {
  ....omitted....
}

Solution 2:[2]

You juste have to add this line

ginSwagger.DefaultModelsExpandDepth(-1))

like that

ginSwagger.WrapHandler(swaggerFiles.Handler,
        ginSwagger.DefaultModelsExpandDepth(-1))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 KevinLiu
Solution 2 Arthur Raimbert