From 1eed1917b91c3b6a506f5033969c95221a288ea5 Mon Sep 17 00:00:00 2001 From: Nick Bruno Date: Thu, 22 Oct 2015 22:33:20 -0400 Subject: [PATCH] Ensure hasMore is updated when reconciling enum properties from parent --- .../codegen/languages/JavaClientCodegen.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index d265e5a723..b492d1bd13 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -507,6 +507,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { List codegenProperties = codegenModel.vars; // Iterate over all of the parent model properties + boolean removedChildEnum = false; for (CodegenProperty parentModelCodegenPropery : parentModelCodegenProperties) { // Look for enums if (parentModelCodegenPropery.isEnum) { @@ -519,12 +520,21 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { // We found an enum in the child class that is // a duplicate of the one in the parent, so remove it. iterator.remove(); + removedChildEnum = true; } } } } - - codegenModel.vars = codegenProperties; + + if(removedChildEnum) { + // If we removed an entry from this model's vars, we need to ensure hasMore is updated + int count = 0, numVars = codegenProperties.size(); + for(CodegenProperty codegenProperty : codegenProperties) { + count += 1; + codegenProperty.hasMore = (count < numVars) ? true : null; + } + codegenModel.vars = codegenProperties; + } } return codegenModel;