diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java index 98770029381..c282fb519a2 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java @@ -122,7 +122,9 @@ public class CodegenParameter { if (this.items != null) { output.items = this.items; } - output.vendorExtensions = this.vendorExtensions; + if(this.vendorExtensions != null){ + output.vendorExtensions = new HashMap(this.vendorExtensions); + } output.hasValidation = this.hasValidation; output.isBinary = this.isBinary; output.isByteArray = this.isByteArray; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java index b6a4b9d02da..66995f8d118 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java @@ -1,5 +1,7 @@ package io.swagger.codegen; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -283,9 +285,24 @@ public class CodegenProperty implements Cloneable { @Override public CodegenProperty clone() { try { - return (CodegenProperty) super.clone(); + CodegenProperty cp = (CodegenProperty) super.clone(); + if (this._enum != null) { + cp._enum = new ArrayList(this._enum); + } + if (this.allowableValues != null) { + cp.allowableValues = new HashMap(this.allowableValues); + } + if (this.items != null) { + cp.items = this.items; + } + if(this.vendorExtensions != null){ + cp.vendorExtensions = new HashMap(this.vendorExtensions); + } + return cp; } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } } + + }