1
0
mirror of https://github.com/beego/bee.git synced 2024-11-24 13:30:53 +00:00

fix struct comment

This commit is contained in:
xinyi 2022-04-24 19:22:39 +08:00
parent 8a299fa755
commit 50ffa7ed8c

View File

@ -1205,6 +1205,10 @@ func parseStruct(imports []*ast.ImportSpec, st *ast.StructType, k string, m *swa
mp.Description = desc mp.Description = desc
} }
if mp.Description == "" && field.Comment != nil {
mp.Description = strings.TrimSpace(field.Comment.Text())
}
if example := stag.Get("example"); example != "" && !isObject && !isSlice { if example := stag.Get("example"); example != "" && !isObject && !isSlice {
mp.Example = str2RealType(example, realType) mp.Example = str2RealType(example, realType)
} }