swag
swag copied to clipboard
generic type support
my golang project use generic type, when i use swag to init api docs, occur error: don't recognise "[]" in generic function or param
Encountering the same problem
using generic type like this, it works
type Result[T any] struct {
Code int64 `json:"code"`
ErrorMsg string `json:"err_msg,omitempty"`
Data T `json:"data,omitempty" swaggerignore:"true"`
}
// @Response 200 {object} res.Result{data=xxx}
oh~ I found now swag is support generic type, the using demo: https://github.com/swaggo/swag/blob/master/testdata/generics_nested/api/api.go
oh~ I found now swag is support generic type, the using demo: https://github.com/swaggo/swag/blob/master/testdata/generics_nested/api/api.go
Maybe we can just add a comprehensive example in the README/examples section?
@ubogdan can we close this issue? Also, do you know if there's any way we could improve this flow of closing issues? I'm seeking issues or features to contribute to but a lot of times I've seen that they were already done but the issue is not closed. Thanks for your help.