swagger 语法
导入项目的文档位置import _ "git.zzpxx.com/backend/xxx/docs" // docs is generated by Swag CLI, you have to import it.// @title Swagger Example API// @version 1.0// @description This is a sample server Petstore
·
导入项目的文档位置
import _ "git.zzpxx.com/backend/xxx/docs" // docs is generated by Swag CLI, you have to import it.
// @title Swagger Example API
// @version 1.0
// @description This is a sample server Petstore server.
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @BasePath /v1/xxx
func main() {}
在route.h
import echoSwagger "github.com/swaggo/echo-swagger"
e.GET("/swagger/*", echoSwagger.WrapHandler)
在控制层函数
// @Tags 导入
// @Summary 导入
// @Description 导入
// @Accept json
// @Produce json
// @Success 200 {object} model.HTTPResponseBody
// @Router /import/xx[post]
// @Tags 导入
// @Summary 导入
// @Description 导入
// @Accept multipart/form-data
// @Param file formData file true "file"
// @Param planId formData string true "id"
// @Produce json
// @Success 200 {object} model.HTTPResponseBody
// @Router /import/xx [post]
执行swag init
更多推荐
已为社区贡献1条内容
所有评论(0)