cleanup: 清理冗余代码
This commit is contained in:
66
generate.go
66
generate.go
@ -84,45 +84,7 @@ func (g *Generate) Doc() *define.OpenapiDoc {
|
||||
return g.docData
|
||||
}
|
||||
|
||||
// SetLicense 设置文档协议
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:56 2024/8/14
|
||||
func (g *Generate) SetLicense(name string, url string) {
|
||||
g.docData.Info.License.Name = name
|
||||
g.docData.Info.License.Url = url
|
||||
}
|
||||
|
||||
// AddTag 新增tag
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:23 2024/8/14
|
||||
func (g *Generate) AddTag(tagName string, tagDesc string) {
|
||||
isHasTag := false
|
||||
for _, item := range g.docData.Tags {
|
||||
if item.Name == tagName {
|
||||
if len(tagDesc) > 0 {
|
||||
item.Description = tagDesc
|
||||
}
|
||||
isHasTag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !isHasTag {
|
||||
g.docData.Tags = append(g.docData.Tags, &define.TagItem{
|
||||
Name: tagName,
|
||||
Description: tagDesc,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// AddServer 添加server
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:45 2024/8/14
|
||||
func (g *Generate) AddServer(serverDomain string, serverDesc string, serverVariable map[string]*define.ServerItemVariable) {
|
||||
if nil == serverVariable {
|
||||
serverVariable = make(map[string]*define.ServerItemVariable)
|
||||
@ -151,35 +113,7 @@ func (g *Generate) AddServer(serverDomain string, serverDesc string, serverVaria
|
||||
}
|
||||
}
|
||||
|
||||
// AddApi 新增Api
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:04 2024/8/14
|
||||
//
|
||||
// baseCfg : 接口基础配置, 示例数据
|
||||
//
|
||||
// &define.UriBaseConfig{
|
||||
// Uri: "/foo/bar",
|
||||
// Method: http.MethodPost,
|
||||
// ContentType: ["application/json"],
|
||||
// TagList: []string{"测试标签"},
|
||||
// Summary: "这是一份示例基础配置",
|
||||
// Description: "这是一份示例基础配置",
|
||||
// }
|
||||
//
|
||||
// paramList : 参数列表
|
||||
//
|
||||
// resultList : 返回值列表
|
||||
func (g *Generate) AddApi(baseCfg *define.UriBaseConfig, paramList []*define.ParamConfig, resultList []*define.ResultConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddApiFromInAndOut 通过请求参数的
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:22 2025/2/9
|
||||
func (g *Generate) AddApiFromInAndOut(uriPrefix string, paramType reflect.Type, resultType reflect.Type) error {
|
||||
if paramType.Kind() == reflect.Ptr {
|
||||
paramType = paramType.Elem()
|
||||
|
Reference in New Issue
Block a user