fibers
fibers copied to clipboard
Support const enums
When I used Swaggo, I was able to do something like this:
type PaginationModel struct {
Search string
Take int
Page int
SortOrder SortOrder
}
type SortOrder string
const (
SortOrderAsc SortOrder = "asc"
SortOrderDesc SortOrder = "desc"
)
this is the result:
I was able to select an enum from the dropdown list in Swagger UI.
But when I try this in fibers
type PaginationModel struct {
Search string `query:"search"`
Take int `query:"take"`
Page int `query:"page"`
SortOrder SortOrder `query:"sortOrder"`
}
type SortOrder string
const (
SortOrderAsc SortOrder = "asc"
SortOrderDesc SortOrder = "desc"
)
it gives me a stack overflow
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020680360 stack=[0xc020680000, 0xc040680000]
fatal error: stack overflow
I tried using validate:"oneof=asc desc"
, it didn't render a dropdown list, and it would be painful to enter every value if I have a lot of const enums, for example: database table fields.