fix(generator): inherit nested schema across operation params
This commit is contained in:
@@ -94,11 +94,15 @@ func AlignParamTypes(params []types.Param, schema []types.Param) []types.Param {
|
||||
schemaByCode[strings.ToLower(strings.TrimSpace(p.Code))] = p
|
||||
}
|
||||
for i, p := range params {
|
||||
if !p.HasSubParams {
|
||||
key := strings.ToLower(strings.TrimSpace(p.Code))
|
||||
sp, ok := schemaByCode[key]
|
||||
if !ok || !sp.HasSubParams {
|
||||
continue
|
||||
}
|
||||
key := strings.ToLower(strings.TrimSpace(p.Code))
|
||||
if sp, ok := schemaByCode[key]; ok && len(sp.SubParams) > 0 {
|
||||
params[i].HasSubParams = true
|
||||
if len(p.SubParams) == 0 {
|
||||
params[i].SubParams = append([]types.Param(nil), sp.SubParams...)
|
||||
} else if len(sp.SubParams) > 0 {
|
||||
params[i].SubParams = AlignParamTypes(p.SubParams, sp.SubParams)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user