From 9ea67e73aa9fecc9bb78acb87e544280b985ddcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=87=E8=B1=AA?= <529280602@qq.com> Date: Wed, 26 Oct 2016 22:48:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D#297?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g_docs.go | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/g_docs.go b/g_docs.go index 6f78329..b15a69b 100644 --- a/g_docs.go +++ b/g_docs.go @@ -769,7 +769,7 @@ func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string } var tagValues []string - var err error + //var err error stag := reflect.StructTag(strings.Trim(field.Tag.Value, "`")) @@ -779,27 +779,27 @@ func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string if r.MatchString(defaultValue) { res := r.FindStringSubmatch(defaultValue) mp.Default = res[1] - switch realType{ - case "int","int64", "int32", "int16", "int8": - if mp.Default, err = strconv.Atoi(res[1]); err != nil{ - ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) - } - - case "bool": - if mp.Default, err = strconv.ParseBool(res[1]); err != nil{ - ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) - } - case "float64": - if mp.Default, err = strconv.ParseFloat(res[1], 64); err != nil{ - ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) - } - case "float32": - if mp.Default, err = strconv.ParseFloat(res[1], 32); err != nil{ - ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) - } - default: - mp.Default = res[1] - } + //switch realType{ + // case "int","int64", "int32", "int16", "int8": + // if mp.Default, err = strconv.Atoi(res[1]); err != nil{ + // ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) + // } + // + // case "bool": + // if mp.Default, err = strconv.ParseBool(res[1]); err != nil{ + // ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) + // } + // case "float64": + // if mp.Default, err = strconv.ParseFloat(res[1], 64); err != nil{ + // ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) + // } + // case "float32": + // if mp.Default, err = strconv.ParseFloat(res[1], 32); err != nil{ + // ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1]) + // } + //default: + // mp.Default = res[1] + //} }else{ ColorLog("[WARN] Invalid default value: %s\n", defaultValue) }