From 2a4e01ceefeb61ef8087d7b7892225edfe99d69f Mon Sep 17 00:00:00 2001 From: dawxy <97687341@qq.com> Date: Fri, 5 May 2017 10:53:05 +0800 Subject: [PATCH] Fixed an error in the basicType of pointer when the swagger document was automatically generated --- generate/swaggergen/g_docs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generate/swaggergen/g_docs.go b/generate/swaggergen/g_docs.go index a9f1c0a..d6c676b 100644 --- a/generate/swaggergen/g_docs.go +++ b/generate/swaggergen/g_docs.go @@ -880,7 +880,11 @@ func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) { } switch t := f.Type.(type) { case *ast.StarExpr: - return false, fmt.Sprint(t.X), "object" + basicType := fmt.Sprint(t.X) + if k, ok := basicTypes[basicType]; ok { + return false, basicType, k + } + return false, basicType, "object" case *ast.MapType: val := fmt.Sprintf("%v", t.Value) if isBasicType(val) {