Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generic type support #1655

Open
hicker-kin opened this issue Aug 24, 2023 · 7 comments
Open

generic type support #1655

hicker-kin opened this issue Aug 24, 2023 · 7 comments

Comments

@hicker-kin
Copy link

my golang project use generic type, when i use swag to init api docs, occur error: don't recognise "[]" in generic function or param

@qmdx
Copy link

qmdx commented Aug 28, 2023

Encountering the same problem

@marsberrys
Copy link

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}

@marsberrys
Copy link

oh~ I found now swag is support generic type, the using demo:
https:/swaggo/swag/blob/master/testdata/generics_nested/api/api.go

@rpedrodasilva10
Copy link
Contributor

oh~ I found now swag is support generic type, the using demo: https:/swaggo/swag/blob/master/testdata/generics_nested/api/api.go

Maybe we can just add a comprehensive example in the README/examples section?

@rpedrodasilva10
Copy link
Contributor

rpedrodasilva10 commented Nov 7, 2023

@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.

@gunb0s
Copy link

gunb0s commented Oct 17, 2024

it seems that swag version v1.16.3 occurs same generic error again, can't recognize type in []

@wksama
Copy link

wksama commented Oct 18, 2024

it seems that swag version v1.16.3 occurs same generic error again, can't recognize type in []

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants