upgrade: update wrapper
This commit is contained in:
@ -17,7 +17,8 @@ import (
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/enums"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper/op_array"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper/op_string"
|
||||
)
|
||||
|
||||
// NewOpenapiDoc ...
|
||||
@ -122,7 +123,7 @@ func (g *Generate) AddApiFromInAndOut(uriPrefix string, paramType reflect.Type,
|
||||
// 接口文档初始化
|
||||
cfg := g.getApiDocBaseCfg(baseCfg, paramType)
|
||||
|
||||
if wrapper.ArrayType(g.readMethodList).Has(baseCfg.Method) >= 0 {
|
||||
if op_array.Has(*op_array.ArrayType[string](g.readMethodList), baseCfg.Method) >= 0 {
|
||||
cfg.RequestBody = nil // get类请求没有request body
|
||||
// 参数解析
|
||||
g.ParseReadConfigParam(baseCfg, cfg, paramType)
|
||||
@ -742,7 +743,7 @@ func (g *Generate) parseBaseUriConfig(uriPrefix string, paramType reflect.Type)
|
||||
res.Deprecated = deprecated == "1" || deprecated == "true"
|
||||
requestContentType := strings.TrimSpace(metaField.Tag.Get(define.TagContentType))
|
||||
if len(requestContentType) == 0 {
|
||||
if wrapper.ArrayType(g.readMethodList).Has(res.Method) >= 0 {
|
||||
if op_array.Has(*op_array.ArrayType[string](g.readMethodList), res.Method) >= 0 {
|
||||
// get类请求
|
||||
requestContentType = consts.MimeTypeXWWWFormUrlencoded
|
||||
} else {
|
||||
@ -758,7 +759,7 @@ func (g *Generate) parseBaseUriConfig(uriPrefix string, paramType reflect.Type)
|
||||
res.OutputContentType = strings.Split(responseContentType, ",")
|
||||
res.Summary = ParseStructFieldTag.Summary(metaField)
|
||||
if len(res.Summary) == 0 {
|
||||
res.Summary = wrapper.String(strings.ReplaceAll(strings.TrimLeft(res.Uri, "/"), "/", "_")).SnakeCaseToCamel()
|
||||
res.Summary = op_string.SnakeCaseToCamel(strings.ReplaceAll(strings.TrimLeft(res.Uri, "/"), "/", "_"))
|
||||
}
|
||||
if res.Method == "" {
|
||||
return nil, errors.New("baseCfg.Method is empty")
|
||||
|
Reference in New Issue
Block a user