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

Function TestSchemaGenericNamingFromModule

schema_test.go:1344–1356  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1342}
1343
1344func TestSchemaGenericNamingFromModule(t *testing.T) {
1345 type SchemaGeneric[T any] struct {
1346 Value T `json:"value"`
1347 }
1348
1349 r := huma.NewMapRegistry("#/components/schemas/", huma.DefaultSchemaNamer)
1350 s := r.Schema(reflect.TypeFor[SchemaGeneric[time.Time]](), true, "")
1351
1352 b, _ := json.Marshal(s)
1353 assert.JSONEq(t, `{
1354 "$ref": "#/components/schemas/SchemaGenericTime"
1355 }`, string(b))
1356}
1357
1358type MyDate time.Time
1359

Callers

nothing calls this directly

Calls 2

SchemaMethod · 0.65
MarshalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…