-
-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
If I have a model that is generic, then there seems to be an issue resolving the schemas. For example, if my model is of type Container[Thing] and I create my route with:
registry.Get("registry", "Get the registry",
responses.OK().Model(Container[Thing]{})).Run(func(ctx huma.Context) {
// The `WriteModel` convenience method handles content negotiation and
// serializaing the response for you.
entity := Container[Thing]{}
entity.Properties = Thing{Name: "Test1"}
ctx.WriteModel(http.StatusOK, entity)
})Then my response yields a Link header of </schemas/Container[main.Thing].json>; rel="describedby". By itself, I don't think this is an issue. But if I try to access the schema that that URL, I get 404 Not Found. Presumably this has something to do with the escaping of the characters in the URL or the pattern matching in the router. Not really sure, but it doesn't find it.
My current solution is to just alias the type in Go, e.g.,
type ContainerThing Container[Thing]This seems to resolve the issue. But I'm not sure I'll have 100% control over such things in nested types.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working