var _ huma.ContentTypeFilter = &Response{}
type Input struct {
Body struct {
Name string `json:"name" doc:"The name."`
}
}
type Response struct {
Message string `json:"message" doc:"The message."`
}
type Output struct {
Body Response
}
func (r *Response) ContentType(t string) string {
return "application/ld+json"
}
What I'm trying to do is override the response Content-Type.
Based on this document: https://pkg.go.dev/github.com/danielgtaylor/huma/v2#ContentTypeFilter I expect that implementation of ContentTypeFilter on Response ( in this case ) would change ContentType in the generated OAS as well.
At the moment, in the generated spec I get the following:
Hi there!
I've got the following types
What I'm trying to do is override the response Content-Type. Based on this document: https://pkg.go.dev/github.com/danielgtaylor/huma/v2#ContentTypeFilter I expect that implementation of
ContentTypeFilter
onResponse
( in this case ) would change ContentType in the generated OAS as well.At the moment, in the generated spec I get the following:
Please help me to understand whether it's expected or not?
Thank you.