This commit is contained in:
白茶清欢 2024-08-19 16:28:46 +08:00
parent 1e1e267719
commit 6bfcab7625
3 changed files with 6 additions and 4 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module git.zhangdeman.cn/gateway/api-doc
go 1.22.2
require (
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240726024939-e424db29c5c4
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240817091513-491f455a23c0
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20240422034417-8c922be06d95
)

2
go.sum
View File

@ -4,6 +4,8 @@ git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240722080005-ca68a3ff8bc7 h1:8wJlcu
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240722080005-ca68a3ff8bc7/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240726024939-e424db29c5c4 h1:mibnyzYbZullK0aTHVASHl3UeoVr8IgytQZsuyv+yEM=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240726024939-e424db29c5c4/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240817091513-491f455a23c0 h1:U12XDtyRrmsqb/wRvRZG9+SBKMCGFNADpiLogsp5POw=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240817091513-491f455a23c0/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20240311030808-e2a2e6a3c211 h1:I/wOsRpCSRkU9vo1u703slQsmK0wnNeZzsWQOGtIAG0=
git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20240311030808-e2a2e6a3c211/go.mod h1:SrtvrQRdzt+8KfYzvosH++gWxo2ShPTzR1m3VQ6uX7U=
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20240325080031-1f58204e8687 h1:uQcGqdzi4UdpZlp4f4FUPeBqoygP58pEKJkmN3ROsE0=

View File

@ -133,7 +133,7 @@ func generatePathParameterConfig(swaggerInfo *define.Swagger, pathConfig *define
namePath := strings.Split(itemParamInput.Name, ".")
realParamName := namePath[0]
parentPath := ""
if strings.ToUpper(itemParamInput.In) == consts.RequestLocationBody && !strings.Contains(realParamName, ".") {
if strings.ToUpper(itemParamInput.In) == consts.RequestDataLocationBody && !strings.Contains(realParamName, ".") {
realParamName = "jsonBody"
parentPath = strings.ReplaceAll(pathConfig.Uri, ".", "-") + ".jsonBody"
}
@ -177,7 +177,7 @@ func generatePathResponseConfig(swaggerInfo *define.Swagger, pathConfig *define.
Type: itemResponseInput.Type,
Description: itemResponseInput.Description,
Name: itemResponseInput.Field,
In: consts.RequestLocationBody,
In: consts.RequestDataLocationBody,
Required: false,
EnumList: nil,
})
@ -298,7 +298,7 @@ func generateParameterDefinitions(swaggerInfo *define.Swagger, uri string, paren
//
// Date : 16:50 2024/4/25
func handleOneLevelSubPath(swaggerInfo *define.Swagger, uri string, parentPath string, subPath string, paramConfig *define.SwaggerParameterInput) {
if paramConfig.In != strings.ToLower(consts.RequestLocationBody) && !isGenerateOutput(parentPath) {
if paramConfig.In != strings.ToLower(consts.RequestDataLocationBody) && !isGenerateOutput(parentPath) {
// 长度为1, 还不在 body, 无需生成结构体
return
}