修复数组ref引用生成错误问题
This commit is contained in:
parent
f82c691011
commit
0e4f5ae1e3
@ -273,7 +273,9 @@ func (g *Generate) AddApiFromInAndOut(baseCfg *define.UriBaseConfig, paramType r
|
||||
//
|
||||
// Date : 15:25 2025/2/8
|
||||
func (g *Generate) AddComponentsSchema(rootSchemaName string, pkgPath string, inputType reflect.Type) string {
|
||||
schemaName := strings.ReplaceAll(pkgPath+"."+inputType.Name(), "/", "-")
|
||||
inputNameArr := strings.Split(inputType.Name(), ".")
|
||||
inputName := inputNameArr[len(inputNameArr)-1]
|
||||
schemaName := strings.ReplaceAll(pkgPath+"."+inputName, "/", "-")
|
||||
if _, exist := g.docData.Components.Schemas[schemaName]; !exist {
|
||||
s := &define.Schema{
|
||||
Nullable: false,
|
||||
@ -410,7 +412,7 @@ func (g *Generate) parseSliceItem(rootSchemaName string, inputType reflect.Type)
|
||||
if len(sliceItemType.PkgPath()) == 0 {
|
||||
return sliceItemType.String()
|
||||
}
|
||||
return sliceItemType.PkgPath() + "." + sliceItemType.String()
|
||||
return sliceItemType.PkgPath() + "." + sliceItemType.Name()
|
||||
}
|
||||
|
||||
// getSchemaRef 获取引用的类型
|
||||
|
Loading…
x
Reference in New Issue
Block a user