forked from loafle/openapi-generator-original
fixed build error
This commit is contained in:
@@ -5,15 +5,14 @@ import io.swagger.models.parameters.BodyParameter;
|
||||
import io.swagger.models.parameters.Parameter;
|
||||
import io.swagger.models.properties.*;
|
||||
import io.swagger.util.Json;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class InlineModelResolver {
|
||||
private Swagger swagger;
|
||||
private boolean skipMatches;
|
||||
@@ -294,7 +293,12 @@ public class InlineModelResolver {
|
||||
@SuppressWarnings("static-method")
|
||||
public Model modelFromProperty(ArrayProperty object, @SuppressWarnings("unused") String path) {
|
||||
String description = object.getDescription();
|
||||
String example = object.getExample();
|
||||
String example = null;
|
||||
|
||||
Object obj = object.getExample();
|
||||
if(obj != null) {
|
||||
example = obj.toString();
|
||||
}
|
||||
Property inner = object.getItems();
|
||||
if (inner instanceof ObjectProperty) {
|
||||
ArrayModel model = new ArrayModel();
|
||||
@@ -308,7 +312,12 @@ public class InlineModelResolver {
|
||||
|
||||
public Model modelFromProperty(ObjectProperty object, String path) {
|
||||
String description = object.getDescription();
|
||||
String example = object.getExample();
|
||||
String example = null;
|
||||
|
||||
Object obj = object.getExample();
|
||||
if(obj != null) {
|
||||
example = obj.toString();
|
||||
}
|
||||
String name = object.getName();
|
||||
Xml xml = object.getXml();
|
||||
Map<String, Property> properties = object.getProperties();
|
||||
@@ -330,7 +339,12 @@ public class InlineModelResolver {
|
||||
@SuppressWarnings("static-method")
|
||||
public Model modelFromProperty(MapProperty object, @SuppressWarnings("unused") String path) {
|
||||
String description = object.getDescription();
|
||||
String example = object.getExample();
|
||||
String example = null;
|
||||
|
||||
Object obj = object.getExample();
|
||||
if(obj != null) {
|
||||
example = obj.toString();
|
||||
}
|
||||
|
||||
ArrayModel model = new ArrayModel();
|
||||
model.setDescription(description);
|
||||
|
||||
@@ -170,37 +170,37 @@ public class XmlExampleGenerator {
|
||||
protected String getExample(Property property) {
|
||||
if (property instanceof DateTimeProperty) {
|
||||
if (property.getExample() != null) {
|
||||
return property.getExample();
|
||||
return property.getExample().toString();
|
||||
} else {
|
||||
return dtFormat.format(new Date());
|
||||
}
|
||||
} else if (property instanceof StringProperty) {
|
||||
if (property.getExample() != null) {
|
||||
return property.getExample();
|
||||
return property.getExample().toString();
|
||||
} else {
|
||||
return "string";
|
||||
}
|
||||
} else if (property instanceof DateProperty) {
|
||||
if (property.getExample() != null) {
|
||||
return property.getExample();
|
||||
return property.getExample().toString();
|
||||
} else {
|
||||
return dateFormat.format(new Date());
|
||||
}
|
||||
} else if (property instanceof IntegerProperty) {
|
||||
if (property.getExample() != null) {
|
||||
return property.getExample();
|
||||
return property.getExample().toString();
|
||||
} else {
|
||||
return "0";
|
||||
}
|
||||
} else if (property instanceof BooleanProperty) {
|
||||
if (property.getExample() != null) {
|
||||
return property.getExample();
|
||||
return property.getExample().toString();
|
||||
} else {
|
||||
return "true";
|
||||
}
|
||||
} else if (property instanceof LongProperty) {
|
||||
if (property.getExample() != null) {
|
||||
return property.getExample();
|
||||
return property.getExample().toString();
|
||||
} else {
|
||||
return "123456";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user