From 390b11d90716d94ec284750f2a55dd86d18ccc89 Mon Sep 17 00:00:00 2001 From: Will Krause Date: Sat, 29 Nov 2014 17:17:21 -0500 Subject: [PATCH] Update g_docs.go This change prevents the omitempty json struct tag from appearing in the swagger documentation. So for a struct like `json:"deviceName,omitempty", only deviceName is taken as the name. --- g_docs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/g_docs.go b/g_docs.go index 04c0400..62263e5 100644 --- a/g_docs.go +++ b/g_docs.go @@ -568,7 +568,8 @@ func getModel(str string) (pkgpath, objectname string, m swagger.Model, realType if field.Tag != nil { stag := reflect.StructTag(strings.Trim(field.Tag.Value, "`")) if tag := stag.Get("json"); tag != "" { - name = tag + leaveomitempty := strings.Split(tag, ",") + name = leaveomitempty[0] } if thrifttag := stag.Get("thrift"); thrifttag != "" { ts := strings.Split(thrifttag, ",")