From 95009c02ba03b9364901a33a83a3e28c540172df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E8=B6=8A=E6=B4=8B?= Date: Wed, 29 Jul 2020 16:29:06 +0800 Subject: [PATCH] add json tag like `json:"xxx,string"` support --- 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 73ba71b..ea20603 100644 --- a/generate/swaggergen/g_docs.go +++ b/generate/swaggergen/g_docs.go @@ -1185,6 +1185,10 @@ func parseStruct(st *ast.StructType, k string, m *swagger.Schema, realTypes *[]s mp.Example = str2RealType(example, realType) } + if len(tagValues) == 2 && tagValues[1] == "string" { + mp.Type = "string" + } + m.Properties[name] = mp } if ignore := stag.Get("ignore"); ignore != "" {