Skip to content

Commit

Permalink
Merge pull request #531 from fourcels/fix-schema-default-value
Browse files Browse the repository at this point in the history
fix(schema):  default value not work
  • Loading branch information
danielgtaylor authored Aug 2, 2024
2 parents 9eae273 + 55bd2cc commit b3725d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@ func SchemaFromField(registry Registry, f reflect.StructField, hint string) *Sch
if enc := f.Tag.Get("encoding"); enc != "" {
fs.ContentEncoding = enc
}
fs.Default = jsonTag(registry, f, fs, "default")
if defaultValue := jsonTag(registry, f, fs, "default"); defaultValue != nil {
fs.Default = defaultValue
}

if value := f.Tag.Get("example"); value != "" {
if e := jsonTagValue(registry, f.Name, fs, value); e != nil {
Expand Down

0 comments on commit b3725d9

Please sign in to comment.