Skip to content

Commit d9f8fcb

Browse files
committed
fixes for #501
1 parent 17ca7c4 commit d9f8fcb

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/DefaultCodegen.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,34 @@ else if(p instanceof DateProperty)
312312
return "null";
313313
else if(p instanceof DateTimeProperty)
314314
return "null";
315-
else if (p instanceof DoubleProperty)
315+
else if (p instanceof DoubleProperty) {
316+
DoubleProperty dp = (DoubleProperty) p;
317+
if(dp.getDefault() != null) {
318+
return dp.getDefault().toString();
319+
}
316320
return "null";
317-
else if (p instanceof FloatProperty)
321+
}
322+
else if (p instanceof FloatProperty) {
323+
FloatProperty dp = (FloatProperty) p;
324+
if(dp.getDefault() != null) {
325+
return dp.getDefault().toString();
326+
}
318327
return "null";
319-
else if (p instanceof IntegerProperty)
328+
}
329+
else if (p instanceof IntegerProperty) {
330+
IntegerProperty dp = (IntegerProperty) p;
331+
if(dp.getDefault() != null) {
332+
return dp.getDefault().toString();
333+
}
320334
return "null";
321-
else if (p instanceof LongProperty)
335+
}
336+
else if (p instanceof LongProperty) {
337+
LongProperty dp = (LongProperty) p;
338+
if(dp.getDefault() != null) {
339+
return dp.getDefault().toString();
340+
}
322341
return "null";
342+
}
323343
else if (p instanceof MapProperty) {
324344
MapProperty ap = (MapProperty) p;
325345
String inner = getSwaggerType(ap.getAdditionalProperties());

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
<swagger-parser-version>1.0.5-SNAPSHOT</swagger-parser-version>
428428
<scala-version>2.10.4</scala-version>
429429
<felix-version>2.3.4</felix-version>
430-
<swagger-core-version>1.5.0-M2</swagger-core-version>
430+
<swagger-core-version>1.5.1-M2-SNAPSHOT</swagger-core-version>
431431
<scala-test-version>2.1.4</scala-test-version>
432432
<commons-io-version>2.3</commons-io-version>
433433
<commons-cli-version>1.2</commons-cli-version>

0 commit comments

Comments
 (0)