Skip to content

Commit

Permalink
fix(schema): default value
Browse files Browse the repository at this point in the history
  • Loading branch information
fourcels committed Aug 2, 2024
1 parent 9eae273 commit 55bd2cc
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 55bd2cc

Please sign in to comment.