MCPcopy
hub / github.com/danielgtaylor/huma / Resolve

Method Resolve

resolver_test.go:21–33  ·  view source on GitHub ↗
(ctx huma.Context, prefix *huma.PathBuffer)

Source from the content-addressed store, hash-verified

19}
20
21func (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
35func ExampleResolver() {
36 // Create the API.

Callers

nothing calls this directly

Calls 1

WithMethod · 0.80

Tested by

no test coverage detected