0

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?

peterh
  • 11,875
  • 18
  • 85
  • 108
iooi
  • 453
  • 2
  • 10
  • 23
  • Does this answer your question? [How to hide the Models section in Swagger UI?](https://stackoverflow.com/q/57138564/113116) – Helen Jan 29 '21 at 08:50

2 Answers2

0

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....
}
KevinLiu
  • 183
  • 2
  • 5
0

You juste have to add this line

ginSwagger.DefaultModelsExpandDepth(-1))

like that

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