Skip to content

os/gtime: issue 规范路由Res中字段类型使用泛型的时候,swagger打开报错 #4366

@keepeye

Description

@keepeye

What do you want to ask?

Something went wrong...
Invalid reference token: backend.internal.util.utree.TreeNode[*backend
Stack trace
Error: Invalid reference token: backend.internal.util.utree.TreeNode[*backend
    at i.get (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:2:182881)
    at nu (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:73372)
    at https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:80613
    at nu (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:74793)
    at https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:81011
    at Array.forEach (<anonymous>)
    at https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:80940
    at nu (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:74793)
    at nu (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:73416)
    at pu (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:41:80270)

ReDoc Version: 2.5.0
Commit: 00bc6ed

规范路由定义如下

type MenuGetReq struct {
	g.Meta `path:"/menu" method:"get" tags:"system" summary:"查询菜单列表"`
}
type MenuGetRes struct {
	g.Meta `mime:"application/json"`
	List   []*utree.TreeNode[*entity.Menu] `json:"list"`
}

// utree.TreeNode
type TreeNode[T any] struct {
	Data     T              `json:"data"`
	Children []*TreeNode[T] `json:"children,omitempty"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions