fix struct comment

This commit is contained in:
xinyi 2022-04-24 19:22:39 +08:00
parent 8a299fa755
commit 50ffa7ed8c
1 changed files with 4 additions and 0 deletions

View File

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