Import inner items for map (#3123)

fix #3094
This commit is contained in:
Thibault Duperron
2019-06-09 05:56:22 +02:00
committed by William Cheng
parent d86f3edc73
commit 314f18a2c1
3 changed files with 383 additions and 1 deletions

View File

@@ -4660,9 +4660,17 @@ public class DefaultCodegen implements CodegenConfig {
schema.setAdditionalProperties(inner);
}
CodegenProperty codegenProperty = fromProperty("property", schema);
// only support 1-dimension map only
imports.add(codegenProperty.baseType);
CodegenProperty innerCp = codegenProperty;
while (innerCp != null) {
if (innerCp.complexType != null) {
imports.add(innerCp.complexType);
}
innerCp = innerCp.items;
}
if (StringUtils.isEmpty(bodyParameterName)) {
codegenParameter.baseName = "request_body";
} else {