1
0
mirror of https://github.com/beego/bee.git synced 2024-11-26 16:41:30 +00:00

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.
This commit is contained in:
Will Krause 2014-11-29 17:17:21 -05:00
parent 26ab2b8e58
commit 390b11d907

View File

@ -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, ",")