diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java index e9b6394be007..7c0dd01be583 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java @@ -656,7 +656,16 @@ public String toDefaultValue(Property p) { return null; } - return String.format(pattern, getTypeDeclaration(ap.getItems())); + String typeDeclaration = getTypeDeclaration(ap.getItems()); + Object java8obj = additionalProperties.get("java8"); + if (java8obj != null) { + Boolean java8 = Boolean.valueOf(java8obj.toString()); + if (java8 != null && java8) { + typeDeclaration = ""; + } + } + + return String.format(pattern, typeDeclaration); } else if (p instanceof MapProperty) { final MapProperty ap = (MapProperty) p; final String pattern; @@ -669,7 +678,16 @@ public String toDefaultValue(Property p) { return null; } - return String.format(pattern, String.format("String, %s", getTypeDeclaration(ap.getAdditionalProperties()))); + String typeDeclaration = String.format("String, %s", getTypeDeclaration(ap.getAdditionalProperties())); + Object java8obj = additionalProperties.get("java8"); + if (java8obj != null) { + Boolean java8 = Boolean.valueOf(java8obj.toString()); + if (java8 != null && java8) { + typeDeclaration = ""; + } + } + + return String.format(pattern, typeDeclaration); } else if (p instanceof IntegerProperty) { IntegerProperty dp = (IntegerProperty) p; if (dp.getDefault() != null) { diff --git a/samples/server/petstore/java-play-framework-controller-only/public/swagger.json b/samples/server/petstore/java-play-framework-controller-only/public/swagger.json index 1c7b9a12eba6..bf0a7a265454 100644 --- a/samples/server/petstore/java-play-framework-controller-only/public/swagger.json +++ b/samples/server/petstore/java-play-framework-controller-only/public/swagger.json @@ -112,8 +112,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/public/swagger.json b/samples/server/petstore/java-play-framework-no-bean-validation/public/swagger.json index 1c7b9a12eba6..bf0a7a265454 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/public/swagger.json +++ b/samples/server/petstore/java-play-framework-no-bean-validation/public/swagger.json @@ -112,8 +112,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/public/swagger.json b/samples/server/petstore/java-play-framework-no-exception-handling/public/swagger.json index 1c7b9a12eba6..bf0a7a265454 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/public/swagger.json +++ b/samples/server/petstore/java-play-framework-no-exception-handling/public/swagger.json @@ -112,8 +112,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/java-play-framework-no-interface/public/swagger.json b/samples/server/petstore/java-play-framework-no-interface/public/swagger.json index 1c7b9a12eba6..bf0a7a265454 100644 --- a/samples/server/petstore/java-play-framework-no-interface/public/swagger.json +++ b/samples/server/petstore/java-play-framework-no-interface/public/swagger.json @@ -112,8 +112,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/public/swagger.json b/samples/server/petstore/java-play-framework-no-wrap-calls/public/swagger.json index 1c7b9a12eba6..bf0a7a265454 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/public/swagger.json +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/public/swagger.json @@ -112,8 +112,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/java-play-framework/public/swagger.json b/samples/server/petstore/java-play-framework/public/swagger.json index 1c7b9a12eba6..bf0a7a265454 100644 --- a/samples/server/petstore/java-play-framework/public/swagger.json +++ b/samples/server/petstore/java-play-framework/public/swagger.json @@ -112,8 +112,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ],