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

Response object type in the @success tag, error with two type parameter generics. #1489

Closed
Bijan-Massoumi opened this issue Mar 6, 2023 · 0 comments

Comments

@Bijan-Massoumi
Copy link

Describe the bug
When specifying a response object type in the @success tag, having a type with two generic values like so:

type (
	ResponseWithMetadata[T any, U any] struct {
		Error    *string `json:"error"`
		Data     T       `json:"data"`
		Metadata U       `json:"metadata,omitempty"`
	}
)

nesting it like this works: // @Success 200 {object} apiutils.ResponseWithMetadata[[]apisnapshot.SnapshotFramework, apiutils.Pagination]

but doing it like this:

type foo = apiutils.ResponseWithMetadata[[]apisnapshot.SnapshotFramework, apiutils.Pagination]
// @Success		200 {object} foo

creates this error:

2023/03/06 10:34:48 Generating github_com_messari_governor-service_internal_models_api_governance.GetGovernanceVotesResponse
2023/03/06 10:34:48 Type definition of type '*ast.IndexListExpr' is not supported yet. Using 'object' instead.

Your swag version
e.g .v1.8.10

Your go version
e.g. 1.19.0

Desktop (please complete the following information):

  • OS: MacOS
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

2 participants