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

Beego api doc, please add support for nested generics #5048

Closed
beblessed2009 opened this issue Aug 16, 2022 · 1 comment
Closed

Beego api doc, please add support for nested generics #5048

beblessed2009 opened this issue Aug 16, 2022 · 1 comment

Comments

@beblessed2009
Copy link

  1. What version of Go and beego are you using (bee version)?

go1.19 beev2.04

  1. What operating system and processor architecture are you using (go env)?

windows

  1. What did you do?

auto generated api docs don't support generic type
// JsonResult
type JsonResult[T any] struct {
Code int json:"errcode"
Message string json:"message"
Data T json:"data,omitempty"
}
// @success 200 {object} controllers.JsonResult[[]models.CategoryModel]
// @failure 200 {object} controllers.JsonResult
// @router /category [get]
func (c *CategoryController) Index() {
categoryModel := &models.CategoryModel{}
list, _ := categoryModel.GetAll()
c.Data["json"] = JsonResult[[]models.CategoryModel]{
Code: ErrCodeSuccess,
Message: "",
Data: list,
}
c.ServeJSON()
}

  1. What did you expect to see?

plz refer to what swaggo has been doing (swaggo/swag#1277)

Adds support for nested generics (generic[string, generic[int]])
Adds support for array parameter on generics (generic[string, []string])
Adds support for generic properties on structs
Adds support for built-in types in generics

@github-actions
Copy link

This issue is inactive for a long time.

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

No branches or pull requests

1 participant