@Param

参数,表示需要传递到服务器端的参数,有五列参数,使用空格或者 tab 分割,五个分别表示的含义如下

1.参数名

2.参数类型,可以有的值是 formData、query、path、body、header,formData 表示是 post 请求的数据,query 表示带在 url 之后的参数,path 表示请求路径上得参数,例如上面例子里面的 key,body 表示是一个 raw 数据请求,header 表示带在 header 信息中得参数。

3.参数类型

4.是否必须

5.注释

get发送query格式参数注释

//swagger注解配置
// @Tags kubernetes
// @Summary 获取测试环境应用pod状态
// @Description 获取测试环境应用pod状态
// @Accept json
// @Produce json
// @param env query string true "env"
// @Router /kubernetes/podstatus [get]
func PodOnlineList(c *gin.Context) {}

post发送json格式参数注释

type PodParam struct {
   Envname string
   Podname string
}

//swagger注解配置
// @Tags kubernetes
// @Summary 重启pod
// @Description 重启应用服务pod
// @Accept json
// @param data body PodParam true "Pod删除请求参数"
// @Produce json
// @Router /kubernetes/poddelete [post]
//@sucess 200 {object} response.JsonResponse "执行结果"
func PodDelect(c *gin.Context) {}

参考文档golang swagger注解说明_golang swagger 注解_mctlilac的博客-CSDN博客

GoFrame系列:6、Swagger使用总结_xiaoyaoyou.xyz的博客-CSDN博客