| 3690 | } |
| 3691 | |
| 3692 | func 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 | |
| 3708 | func TestParameterExampleRedundancy(t *testing.T) { |
| 3709 | _, app := humatest.New(t, huma.DefaultConfig("Test API", "1.0.0")) |