Skip to content

Commit 77771f0

Browse files
authored
Use func to get the tag value with check. (#2053)
1 parent 2d2536e commit 77771f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

field_parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ func (ps *tagBaseFieldParser) complementSchema(schema *spec.Schema, types []stri
405405

406406
schema.ReadOnly = ps.tag.Get(readOnlyTag) == "true"
407407

408-
defaultTagValue := ps.tag.Get(defaultTag)
409-
if defaultTagValue != "" {
408+
defaultTagValue, ok := ps.tag.Lookup(defaultTag)
409+
if ok {
410410
value, err := defineType(field.schemaType, defaultTagValue)
411411
if err != nil {
412412
return err

0 commit comments

Comments
 (0)