forked from loafle/openapi-generator-original
Merge pull request #1359 from wing328/better_exception_handling2
Better exception handling
This commit is contained in:
@@ -492,10 +492,16 @@ public class DefaultCodegen {
|
||||
} else if (p instanceof DecimalProperty) {
|
||||
datatype = "number";
|
||||
} else if (p instanceof RefProperty) {
|
||||
RefProperty r = (RefProperty) p;
|
||||
datatype = r.get$ref();
|
||||
if (datatype.indexOf("#/definitions/") == 0) {
|
||||
datatype = datatype.substring("#/definitions/".length());
|
||||
try {
|
||||
RefProperty r = (RefProperty) p;
|
||||
datatype = r.get$ref();
|
||||
if (datatype.indexOf("#/definitions/") == 0) {
|
||||
datatype = datatype.substring("#/definitions/".length());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Error obtaining the datatype from RefProperty:" + p + ". Datatype default to Object");
|
||||
datatype = "Object";
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (p != null) {
|
||||
@@ -584,7 +590,7 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
// interfaces (intermediate models)
|
||||
if (allDefinitions != null) {
|
||||
if (allDefinitions != null && composed.getInterfaces() != null) {
|
||||
for (RefModel _interface : composed.getInterfaces()) {
|
||||
final String interfaceRef = toModelName(_interface.getSimpleRef());
|
||||
final Model interfaceModel = allDefinitions.get(interfaceRef);
|
||||
|
||||
Reference in New Issue
Block a user