Skip to content

Commit

Permalink
Fix for regression in issue: swagger-api#6472 (swagger-api#6480)
Browse files Browse the repository at this point in the history
  • Loading branch information
JFCote authored and fvarose committed Oct 12, 2017
1 parent 136affa commit 9362c6f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down

0 comments on commit 9362c6f

Please sign in to comment.