From 4ef471170e488f93cd52eaf29e82eb0913f55162 Mon Sep 17 00:00:00 2001 From: dawxy <97687341@qq.com> Date: Mon, 8 May 2017 08:38:06 +0800 Subject: [PATCH 1/2] Fixed an error in the basicType of pointer when the swagger document was automatically generated --- generate/swaggergen/g_docs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generate/swaggergen/g_docs.go b/generate/swaggergen/g_docs.go index 635ef06..3df90e8 100644 --- a/generate/swaggergen/g_docs.go +++ b/generate/swaggergen/g_docs.go @@ -877,6 +877,10 @@ func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) { } switch t := f.Type.(type) { case *ast.StarExpr: + basicType := fmt.Sprint(t.X) + if k, ok := basicTypes[basicType]; ok { + return false, basicType, k + } return false, fmt.Sprint(t.X), "object" case *ast.MapType: val := fmt.Sprintf("%v", t.Value) From 49d791502a4969287b1bfe44eb3d2702743040a5 Mon Sep 17 00:00:00 2001 From: dawxy <97687341@qq.com> Date: Mon, 8 May 2017 08:41:12 +0800 Subject: [PATCH 2/2] Fixed an error in the basicType of pointer when the swagger document was automatically generated --- generate/swaggergen/g_docs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate/swaggergen/g_docs.go b/generate/swaggergen/g_docs.go index 3df90e8..a23a677 100644 --- a/generate/swaggergen/g_docs.go +++ b/generate/swaggergen/g_docs.go @@ -881,7 +881,7 @@ func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) { if k, ok := basicTypes[basicType]; ok { return false, basicType, k } - return false, fmt.Sprint(t.X), "object" + return false, basicType, "object" case *ast.MapType: val := fmt.Sprintf("%v", t.Value) if isBasicType(val) {