mirror of
https://github.com/beego/bee.git
synced 2024-11-21 18:40:54 +00:00
required description
This commit is contained in:
parent
b13c2068a9
commit
6181668e0a
14
g_docs.go
14
g_docs.go
@ -535,14 +535,22 @@ func getModel(str string) (pkgpath, objectname string, m swagger.Model, realType
|
||||
// if the tag contains json tag, set the name to the left most json tag
|
||||
var name = field.Names[0].Name
|
||||
if field.Tag != nil {
|
||||
mp.Description = strings.Trim(field.Tag.Value, "`")
|
||||
stag := reflect.StructTag(mp.Description)
|
||||
stag := reflect.StructTag(strings.Trim(field.Tag.Value, "`"))
|
||||
if tag := stag.Get("json"); tag != "" {
|
||||
name = tag
|
||||
}
|
||||
if beedoc := stag.Get("beedoc"); beedoc == "required" {
|
||||
if thrifttag := stag.Get("thrift"); thrifttag != "" {
|
||||
ts := strings.Split(thrifttag, ",")
|
||||
if ts[0] != "" {
|
||||
name = ts[0]
|
||||
}
|
||||
}
|
||||
if required := stag.Get("required"); required != "" {
|
||||
m.Required = append(m.Required, name)
|
||||
}
|
||||
if desc := stag.Get("description"); desc != "" {
|
||||
mp.Description = desc
|
||||
}
|
||||
}
|
||||
m.Properties[name] = mp
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user