diff --git a/huma.go b/huma.go index c377b7b6..9157424b 100644 --- a/huma.go +++ b/huma.go @@ -163,8 +163,8 @@ func findParams(registry Registry, op *Operation, t reflect.Type) *findResult[*p pfi.Schema = SchemaFromField(registry, f, "") var example any - if e := f.Tag.Get("example"); e != "" { - example = jsonTagValue(registry, f.Type.Name(), pfi.Schema, f.Tag.Get("example")) + if value, ok := f.Tag.Lookup("example"); ok { + example = jsonTagValue(registry, f.Type.Name(), pfi.Schema, value) } if example == nil && len(pfi.Schema.Examples) > 0 { example = pfi.Schema.Examples[0] diff --git a/schema.go b/schema.go index 19a44e44..94b4530d 100644 --- a/schema.go +++ b/schema.go @@ -558,7 +558,7 @@ func SchemaFromField(registry Registry, f reflect.StructField, hint string) *Sch fs.Default = defaultValue } - if value := f.Tag.Get("example"); value != "" { + if value, ok := f.Tag.Lookup("example"); ok { if e := jsonTagValue(registry, f.Name, fs, value); e != nil { fs.Examples = []any{e} }