gin-swagger 生成API的问题

如题:gin配合swagger生成restful api文档。但渲染结果和想象中有点出入。

// @Summary 添加用户
// @accept multipart/form-data
// @Produce json
// @Param email formData string true "用户邮箱地址"
// @Param username formData string true "用户名"
// @Param password formData string true "用户密码"
// @Success 200 {string} json "{"code":200,"data":[],"msg":{"title":"ok"}}"
// @Router /api/v1/users [post]

使用命令$swag init生成的确是:

...
...
"parameters": [
                    {
                        "type": "file",
                        "description": "用户邮箱地址",
                        "name": "email",
                        "in": "formData",
                        "required": true
                    },
                    {
                        "type": "file",
                        "description": "用户名",
                        "name": "username",
                        "in": "formData",
                        "required": true
                    },
                    {
                        "type": "file",
                        "description": "用户密码",
                        "name": "password",
                        "in": "formData",
                        "required": true
                    }
                ],
                ...
                ...

为什么生成前后的格式不同了?

阅读 6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题