From 11571b4af2add6c7b995fa87d7efe2f3e1e0fbe1 Mon Sep 17 00:00:00 2001 From: astaxie Date: Wed, 17 Aug 2016 23:48:38 +0800 Subject: [PATCH] fix beego#2016 --- g_docs.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/g_docs.go b/g_docs.go index b8c06da..005204d 100644 --- a/g_docs.go +++ b/g_docs.go @@ -413,9 +413,15 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat pp := strings.Split(p[2], ".") typ := pp[len(pp)-1] if len(pp) >= 2 { + cmpath, m, mod, realTypes := getModel(typ) para.Schema = &swagger.Schema{ - Ref: "#/definitions/" + typ, + Ref: "#/definitions/" + m, } + if _, ok := modelsList[pkgpath+controllerName]; !ok { + modelsList[pkgpath+controllerName] = make(map[string]swagger.Schema, 0) + } + modelsList[pkgpath+controllerName][typ] = mod + appendModels(cmpath, pkgpath, controllerName, realTypes) } else { if typ == "string" || typ == "number" || typ == "integer" || typ == "boolean" || typ == "array" || typ == "file" {