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

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
}