MCPcopy Index your code
hub / github.com/danielgtaylor/huma / TestSchemaWithExample

Function TestSchemaWithExample

huma_test.go:3692–3706  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3690}
3691
3692func TestSchemaWithExample(t *testing.T) {
3693 _, app := humatest.New(t, huma.DefaultConfig("Test API", "1.0.0"))
3694 huma.Register(app, huma.Operation{
3695 OperationID: "test",
3696 Method: http.MethodGet,
3697 Path: "/test",
3698 }, func(ctx context.Context, input *struct {
3699 Test SchemaWithExample `query:"test"`
3700 }) (*struct{}, error) {
3701 return nil, nil
3702 })
3703
3704 example := app.OpenAPI().Paths["/test"].Get.Parameters[0].Schema.Examples[0]
3705 assert.Equal(t, 1, example)
3706}
3707
3708func TestParameterExampleRedundancy(t *testing.T) {
3709 _, app := humatest.New(t, huma.DefaultConfig("Test API", "1.0.0"))

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
OpenAPIMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…