Enabling recursive process structs for patameters
On huma parameters are not checked recursively, on structs which limits us to only embedding structs for queries on humas code on huma/huma.go line 213: it sets recurseFields to false, , false, "Body")
but because of that it prevents use of nested structs specially for such cases func (uh *IGenericController[T, C, U, F, Q]) OffsetPaginated(ctx context.Context, filter *struct { Filter F Query Q dtos.PaginationInput }) (*dtos.HumaResponse[dtos.PResp[[]T]], error) {
resp, err := DbFetchManyWithOffset[T](uh.GormConn, ctx, filter.Filter, filter.PaginationInput)
return dtos.PHumaReturn(resp, err)
}
because F and Q are Generic type i could not just embed them with out Filter & Query fields, so only by setting the value on huma/huma.go:213 we can fix this problem
I would also like to know why we can't use struct embedded types or how to use them for request types.
For example, I would like to do,
type pagination struct {
Limit int32 `query:"limit" default:"20" minimum:"1" maximum:"100"`
Offset int32 `query:"offset" default:"0" minimum:"0"`
}
type email struct {
Email string `query:"Email" format:"email" example:"[email protected]"`
}
func (s *Server) ListUsers(ctx context.Context, input *struct{pagination; email}) (*response[userArray], error) {
}
effectively