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 2808c9dcc2..b40aca5053 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 @@ -33,6 +33,8 @@ public class CodegenProperty { public Boolean exclusiveMaximum; public Boolean hasMore, required, secondaryParam; public Boolean isPrimitiveType, isContainer, isNotContainer; + public Boolean isString, isInteger, isLong, isFloat, isDouble, isByte, isBinary, isBoolean, isDate, isDateTime; + public Boolean isListContainer, isMapContainer; public boolean isEnum; public Boolean isReadOnly = false; public List _enum; @@ -81,6 +83,18 @@ public class CodegenProperty { result = prime * result + ((setter == null) ? 0 : setter.hashCode()); result = prime * result + ((unescapedDescription == null) ? 0 : unescapedDescription.hashCode()); result = prime * result + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); + result = prime * result + ((isString == null) ? 0 : isString.hashCode()); + result = prime * result + ((isInteger == null) ? 0 : isInteger.hashCode()); + result = prime * result + ((isLong == null) ? 0 : isLong.hashCode()); + result = prime * result + ((isFloat == null) ? 0 : isFloat.hashCode()); + result = prime * result + ((isDouble == null) ? 0 : isDouble.hashCode()); + result = prime * result + ((isByte == null) ? 0 : isByte.hashCode()); + result = prime * result + ((isBinary == null) ? 0 : isBinary.hashCode()); + result = prime * result + ((isBoolean == null) ? 0 : isBoolean.hashCode()); + result = prime * result + ((isDate == null) ? 0 : isDate.hashCode()); + result = prime * result + ((isDateTime == null) ? 0 : isDateTime.hashCode()); + result = prime * result + ((isMapContainer == null) ? 0 : isMapContainer.hashCode()); + result = prime * result + ((isListContainer == null) ? 0 : isListContainer.hashCode()); return result; } @@ -189,6 +203,42 @@ public class CodegenProperty { if (this.vendorExtensions != other.vendorExtensions && (this.vendorExtensions == null || !this.vendorExtensions.equals(other.vendorExtensions))) { return false; } + if (this.isString != other.isString && (this.isString == null || !this.isString.equals(other.isString))) { + return false; + } + if (this.isInteger != other.isInteger && (this.isInteger == null || !this.isInteger.equals(other.isInteger))) { + return false; + } + if (this.isLong != other.isLong && (this.isLong == null || !this.isLong.equals(other.isLong))) { + return false; + } + if (this.isFloat != other.isFloat && (this.isFloat == null || !this.isFloat.equals(other.isFloat))) { + return false; + } + if (this.isDouble != other.isDouble && (this.isDouble == null || !this.isDouble.equals(other.isDouble))) { + return false; + } + if (this.isByte != other.isByte && (this.isByte == null || !this.isByte.equals(other.isByte))) { + return false; + } + if (this.isBoolean != other.isBoolean && (this.isBoolean == null || !this.isBoolean.equals(other.isBoolean))) { + return false; + } + if (this.isDate != other.isDate && (this.isDate == null || !this.isDate.equals(other.isDate))) { + return false; + } + if (this.isDateTime != other.isDateTime && (this.isDateTime == null || !this.isDateTime.equals(other.isDateTime))) { + return false; + } + if (this.isBinary != other.isBinary && (this.isBinary == null || !this.isBinary.equals(other.isBinary))) { + return false; + } + if (this.isListContainer != other.isListContainer && (this.isListContainer == null || !this.isListContainer.equals(other.isListContainer))) { + return false; + } + if (this.isMapContainer != other.isMapContainer && (this.isMapContainer == null || !this.isMapContainer.equals(other.isMapContainer))) { + return false; + } return true; } } 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 0ad30ed845..35b1cbe650 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 @@ -1020,6 +1020,7 @@ public class DefaultCodegen { property.maxLength = sp.getMaxLength(); property.minLength = sp.getMinLength(); property.pattern = sp.getPattern(); + property.isString = true; if (sp.getEnum() != null) { List _enum = sp.getEnum(); property._enum = _enum; @@ -1034,6 +1035,7 @@ public class DefaultCodegen { if (p instanceof IntegerProperty) { IntegerProperty sp = (IntegerProperty) p; + property.isInteger = true; if (sp.getEnum() != null) { List _enum = sp.getEnum(); property._enum = new ArrayList(); @@ -1051,6 +1053,7 @@ public class DefaultCodegen { if (p instanceof LongProperty) { LongProperty sp = (LongProperty) p; + property.isLong = true; if (sp.getEnum() != null) { List _enum = sp.getEnum(); property._enum = new ArrayList(); @@ -1068,6 +1071,7 @@ public class DefaultCodegen { if (p instanceof DoubleProperty) { DoubleProperty sp = (DoubleProperty) p; + property.isDouble = true; if (sp.getEnum() != null) { List _enum = sp.getEnum(); property._enum = new ArrayList(); @@ -1085,6 +1089,7 @@ public class DefaultCodegen { if (p instanceof FloatProperty) { FloatProperty sp = (FloatProperty) p; + property.isFloat = true; if (sp.getEnum() != null) { List _enum = sp.getEnum(); property._enum = new ArrayList(); @@ -1102,6 +1107,7 @@ public class DefaultCodegen { if (p instanceof DateProperty) { DateProperty sp = (DateProperty) p; + property.isDate = true; if (sp.getEnum() != null) { List _enum = sp.getEnum(); property._enum = new ArrayList(); @@ -1119,6 +1125,7 @@ public class DefaultCodegen { if (p instanceof DateTimeProperty) { DateTimeProperty sp = (DateTimeProperty) p; + property.isDateTime = true; if (sp.getEnum() != null) { List _enum = sp.getEnum(); property._enum = new ArrayList(); @@ -1146,6 +1153,7 @@ public class DefaultCodegen { if (p instanceof ArrayProperty) { property.isContainer = true; + property.isListContainer = true; property.containerType = "array"; ArrayProperty ap = (ArrayProperty) p; CodegenProperty cp = fromProperty(property.name, ap.getItems()); @@ -1168,6 +1176,7 @@ public class DefaultCodegen { } } else if (p instanceof MapProperty) { property.isContainer = true; + property.isMapContainer = true; property.containerType = "map"; MapProperty ap = (MapProperty) p; CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties());