Merge pull request #603 from LnZd/fix-required-tag

Fix required struct tag
This commit is contained in:
Ming Deng 2021-02-09 19:48:53 +08:00 committed by GitHub
commit 21f42e22a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1162,7 +1162,7 @@ func parseStruct(st *ast.StructType, k string, m *swagger.Schema, realTypes *[]s
name = ts[0]
}
}
if required := stag.Get("required"); required != "" {
if required := stag.Get("required"); strings.EqualFold(required, "true") {
m.Required = append(m.Required, name)
}
if desc := stag.Get("description"); desc != "" {