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 a69f719718..289fd60c2c 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 @@ -9,7 +9,7 @@ public class CodegenParameter { public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, isContainer, secondaryParam, isCollectionFormatMulti, isPrimitiveType; - public String baseName, paramName, dataType, datatypeWithEnum, collectionFormat, description, unescapedDescription, baseType, defaultValue; + public String baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue; public String example; // example value (x-example) public String jsonSchema; public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime; @@ -85,6 +85,7 @@ public class CodegenParameter { output.paramName = this.paramName; output.dataType = this.dataType; output.datatypeWithEnum = this.datatypeWithEnum; + output.dataFormat = this.dataFormat; output.collectionFormat = this.collectionFormat; output.isCollectionFormatMulti = this.isCollectionFormatMulti; output.description = this.description; @@ -181,6 +182,8 @@ public class CodegenParameter { return false; if (datatypeWithEnum != null ? !datatypeWithEnum.equals(that.datatypeWithEnum) : that.datatypeWithEnum != null) return false; + if (dataFormat != null ? !dataFormat.equals(that.dataFormat) : that.dataFormat != null) + return false; if (collectionFormat != null ? !collectionFormat.equals(that.collectionFormat) : that.collectionFormat != null) return false; if (description != null ? !description.equals(that.description) : that.description != null) @@ -276,6 +279,7 @@ public class CodegenParameter { result = 31 * result + (paramName != null ? paramName.hashCode() : 0); result = 31 * result + (dataType != null ? dataType.hashCode() : 0); result = 31 * result + (datatypeWithEnum != null ? datatypeWithEnum.hashCode() : 0); + result = 31 * result + (dataFormat != null ? dataFormat.hashCode() : 0); result = 31 * result + (collectionFormat != null ? collectionFormat.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (unescapedDescription != null ? unescapedDescription.hashCode() : 0); 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 8f6f716152..7462094acc 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 @@ -6,7 +6,7 @@ import java.util.Objects; public class CodegenProperty implements Cloneable { public String baseName, complexType, getter, setter, description, datatype, datatypeWithEnum, - name, min, max, defaultValue, defaultValueWithParam, baseType, containerType; + dataFormat, name, min, max, defaultValue, defaultValueWithParam, baseType, containerType; public String unescapedDescription; @@ -66,6 +66,7 @@ public class CodegenProperty implements Cloneable { result = prime * result + ((containerType == null) ? 0 : containerType.hashCode()); result = prime * result + ((datatype == null) ? 0 : datatype.hashCode()); result = prime * result + ((datatypeWithEnum == null) ? 0 : datatypeWithEnum.hashCode()); + result = prime * result + ((dataFormat == null) ? 0 : dataFormat.hashCode()); result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); result = prime * result + ((defaultValueWithParam == null) ? 0 : defaultValueWithParam.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); @@ -143,6 +144,9 @@ public class CodegenProperty implements Cloneable { if ((this.datatypeWithEnum == null) ? (other.datatypeWithEnum != null) : !this.datatypeWithEnum.equals(other.datatypeWithEnum)) { return false; } + if ((this.dataFormat == null) ? (other.dataFormat != null) : !this.dataFormat.equals(other.dataFormat)) { + return false; + } if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { return false; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index d2bb3aed87..786119b49f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1543,6 +1543,7 @@ public class DefaultCodegen { } } property.datatype = getTypeDeclaration(p); + property.dataFormat = p.getFormat(); // this can cause issues for clients which don't support enums if (property.isEnum) { @@ -2143,6 +2144,7 @@ public class DefaultCodegen { setParameterBooleanFlagWithCodegenProperty(p, cp); p.dataType = cp.datatype; + p.dataFormat = cp.dataFormat; if(cp.isEnum) { p.datatypeWithEnum = cp.datatypeWithEnum; } diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache index 33b4610141..5f8392f34e 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache @@ -1,3 +1,3 @@ {{#isFormParam}}