add json tag like `json:"xxx,string"` support

This commit is contained in:
郭越洋 2020-07-29 16:29:06 +08:00
parent 6a2f44720e
commit 95009c02ba
1 changed files with 4 additions and 0 deletions

View File

@ -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 != "" {