1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 20:20:55 +00:00

Update g_docs.go

add parase datatype in params
This commit is contained in:
Damon Wang 2016-07-06 14:32:36 +08:00 committed by GitHub
parent ddc5da6a38
commit f4b992174c

View File

@ -446,6 +446,23 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat
para.Description = p[3] para.Description = p[3]
} }
opts.Parameters = append(opts.Parameters, para) opts.Parameters = append(opts.Parameters, para)
//bug parase datatype in params begin
if para.ParamType == "body" {
if para.DataType == "" {
panic(controllerName + " " + funcName + " has no object")
}
cmpath, _, mod, realTypes := getModel(p[2])
//ll := strings.Split(st[2], ".")
//opts.Type = ll[len(ll)-1]
//rs.ResponseModel = m
if _, ok := modelsList[pkgpath+controllerName]; !ok {
modelsList[pkgpath+controllerName] = make(map[string]swagger.Model, 0)
}
modelsList[pkgpath+controllerName][para.DataType] = mod
appendModels(cmpath, pkgpath, controllerName, realTypes)
}
//bug parase datatype in params end
} else if strings.HasPrefix(t, "@Failure") { } else if strings.HasPrefix(t, "@Failure") {
rs := swagger.ResponseMessage{} rs := swagger.ResponseMessage{}
st := strings.TrimSpace(t[len("@Failure"):]) st := strings.TrimSpace(t[len("@Failure"):])