(ctx huma.Context, prefix *huma.PathBuffer)
| 19 | } |
| 20 | |
| 21 | func (b *ExampleInputBody) Resolve(ctx huma.Context, prefix *huma.PathBuffer) []error { |
| 22 | // Return an error if some arbitrary rule is broken. In this case, if it's |
| 23 | // a multiple of 30 we return an error. |
| 24 | if b.Count%30 == 0 { |
| 25 | return []error{&huma.ErrorDetail{ |
| 26 | Location: prefix.With("count"), |
| 27 | Message: "multiples of 30 are not allowed", |
| 28 | Value: b.Count, |
| 29 | }} |
| 30 | } |
| 31 | |
| 32 | return nil |
| 33 | } |
| 34 | |
| 35 | func ExampleResolver() { |
| 36 | // Create the API. |