mirror of
https://github.com/beego/bee.git
synced 2024-11-26 21:51: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:
parent
26ab2b8e58
commit
390b11d907
@ -568,7 +568,8 @@ func getModel(str string) (pkgpath, objectname string, m swagger.Model, realType
|
|||||||
if field.Tag != nil {
|
if field.Tag != nil {
|
||||||
stag := reflect.StructTag(strings.Trim(field.Tag.Value, "`"))
|
stag := reflect.StructTag(strings.Trim(field.Tag.Value, "`"))
|
||||||
if tag := stag.Get("json"); tag != "" {
|
if tag := stag.Get("json"); tag != "" {
|
||||||
name = tag
|
leaveomitempty := strings.Split(tag, ",")
|
||||||
|
name = leaveomitempty[0]
|
||||||
}
|
}
|
||||||
if thrifttag := stag.Get("thrift"); thrifttag != "" {
|
if thrifttag := stag.Get("thrift"); thrifttag != "" {
|
||||||
ts := strings.Split(thrifttag, ",")
|
ts := strings.Split(thrifttag, ",")
|
||||||
|
Loading…
Reference in New Issue
Block a user