feat: 增加文档数据初始化逻辑
This commit is contained in:
@@ -34,20 +34,21 @@ func TestGenerate_AddApiDoc(t *testing.T) {
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" description:"更新时间"`
|
||||
Category *Category `json:"category,omitempty" description:"分类"`
|
||||
}
|
||||
instance := NewGenerate()
|
||||
instance.AddApiDoc(define.UriConfig{
|
||||
docFlag := "demo"
|
||||
DocManager.NewOpenApiDoc(docFlag)
|
||||
DocManager.AddApiDoc(docFlag, define.UriConfig{
|
||||
Path: "/a/b/c",
|
||||
RequestMethod: http.MethodGet,
|
||||
TagList: []string{"test"},
|
||||
Desc: "测试接口",
|
||||
}, Category{}, Product{})
|
||||
instance.AddApiDoc(define.UriConfig{
|
||||
DocManager.AddApiDoc(docFlag, define.UriConfig{
|
||||
Path: "/a/b/c",
|
||||
RequestMethod: http.MethodPost,
|
||||
TagList: []string{"test"},
|
||||
Desc: "测试接口",
|
||||
}, Category{}, Product{})
|
||||
// 输出 JSON
|
||||
data, _ := json.MarshalIndent(instance.doc, "", " ")
|
||||
data, _ := json.MarshalIndent(DocManager.docTable[docFlag], "", " ")
|
||||
fmt.Println(string(data))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user