forked from loafle/openapi-generator-original
Fix Integer stub value defaulting to String in nodejs-server if format not specified (#4436)
* check if property is a BaseIntegerProperty. This can occur when format is not specified in Swagger definition * Change coding style to be more consistent
This commit is contained in:
parent
ba285759e1
commit
d7afb22f1f
@ -3,6 +3,7 @@ package io.swagger.codegen.examples;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.ModelImpl;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.BaseIntegerProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
import io.swagger.models.properties.DateProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
@ -108,6 +109,9 @@ public class ExampleGenerator {
|
||||
return 123;
|
||||
} else if (property instanceof LongProperty) {
|
||||
return 123456789L;
|
||||
// Properties that are not Integer or Long may still be BaseInteger
|
||||
} else if (property instanceof BaseIntegerProperty) {
|
||||
return 123;
|
||||
} else if (property instanceof MapProperty) {
|
||||
Map<String, Object> mp = new HashMap<String, Object>();
|
||||
if (property.getName() != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user