Skip to content

Commit

Permalink
Reverted attempts to reuse recursive type-finding code.
Browse files Browse the repository at this point in the history
  • Loading branch information
eak24 committed Jan 7, 2022
1 parent 61263ff commit 96a6ecd
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,13 @@ protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map<S
if (StringUtils.isBlank(interfaceSchema.get$ref())) {
// primitive type
String languageType = getTypeDeclaration(interfaceSchema);
addImports(m.imports, fromProperty(languageType, interfaceSchema));
CodegenProperty interfaceProperty = fromProperty(languageType, interfaceSchema);
if (ModelUtils.isArraySchema(interfaceSchema) || ModelUtils.isMapSchema(interfaceSchema)) {
while (interfaceProperty != null) {
addImport(m, interfaceProperty.complexType);
interfaceProperty = interfaceProperty.items;
}
}

if (composed.getAnyOf() != null) {
if (m.anyOf.contains(languageType)) {
Expand Down Expand Up @@ -6371,7 +6377,11 @@ public CodegenParameter fromFormProperty(String name, Schema propertySchema, Set
// default to csv:
codegenParameter.collectionFormat = StringUtils.isEmpty(collectionFormat) ? "csv" : collectionFormat;

addImports(imports, arrayInnerProperty);
// recursively add import
while (arrayInnerProperty != null) {
imports.add(arrayInnerProperty.baseType);
arrayInnerProperty = arrayInnerProperty.items;
}
} else {
// referenced schemas
;
Expand All @@ -6398,7 +6408,10 @@ public CodegenParameter fromFormProperty(String name, Schema propertySchema, Set
codegenParameter.enumName = codegenProperty.enumName;
}

addImports(imports, codegenProperty);
// import
if (codegenProperty.complexType != null) {
imports.add(codegenProperty.complexType);
}

setParameterExampleValue(codegenParameter);
// set nullable
Expand Down

0 comments on commit 96a6ecd

Please sign in to comment.