Merge pull request #2342 from swagger-api/issue-2341

added import when description is present
This commit is contained in:
Tony Tam
2016-03-09 10:08:21 -08:00
2 changed files with 8 additions and 5 deletions

View File

@@ -525,7 +525,9 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) {
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
if(codegenModel.description != null) {
codegenModel.imports.add("ApiModel");
}
if (allDefinitions != null && codegenModel != null && codegenModel.parentSchema != null && codegenModel.hasEnums) {
final Model parentModel = allDefinitions.get(codegenModel.parentSchema);
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
@@ -584,6 +586,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
for (Object _mo : models) {
Map<String, Object> mo = (Map<String, Object>) _mo;
CodegenModel cm = (CodegenModel) mo.get("model");
for (CodegenProperty var : cm.vars) {
Map<String, Object> allowableValues = var.allowableValues;