Skip to content

Commit

Permalink
fix(schema): schema example not work in Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fourcels committed Aug 2, 2024
1 parent 9eae273 commit a94871d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions huma.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ func findParams(registry Registry, op *Operation, t reflect.Type) *findResult[*p
if e := f.Tag.Get("example"); e != "" {
example = jsonTagValue(registry, f.Type.Name(), pfi.Schema, f.Tag.Get("example"))
}
if example == nil && len(pfi.Schema.Examples) > 0 {
example = pfi.Schema.Examples[0]

Check warning on line 171 in huma.go

View check run for this annotation

Codecov / codecov/patch

huma.go#L171

Added line #L171 was not covered by tests
}

// While discouraged, make it possible to make query/header params required.
if r := f.Tag.Get("required"); r == "true" {
Expand Down

0 comments on commit a94871d

Please sign in to comment.