Skip to content

Commit

Permalink
Fix NPEs in Java generator (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
delenius authored and wing328 committed May 26, 2018
1 parent 4d7ff8c commit 7db0201
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> al
}
// parent model
final String parentName = getParentName(composed, allDefinitions);
final Schema parent = StringUtils.isBlank(parentName) ? null : allDefinitions.get(parentName);
final Schema parent = StringUtils.isBlank(parentName) || allDefinitions == null ? null : allDefinitions.get(parentName);

List<Schema> interfaces = getInterfaces(composed);

Expand Down Expand Up @@ -4097,7 +4097,12 @@ public List<CodegenParameter> fromRequestBodyToFormParameters(RequestBody body,
codegenParameter.isListContainer = true;
codegenParameter.description = s.getDescription();
codegenParameter.dataType = getTypeDeclaration(s);
codegenParameter.datatypeWithEnum = codegenParameter.dataType.replace(codegenParameter.baseType, codegenParameter.enumName);
if (codegenParameter.baseType != null && codegenParameter.enumName != null){
codegenParameter.datatypeWithEnum = codegenParameter.dataType.replace(codegenParameter.baseType, codegenParameter.enumName);
}
else {
LOGGER.warn("Could not compute datatypeWithEnum from " + codegenParameter.baseType + ", " + codegenParameter.enumName);
}
//TODO fix collectformat for form parameters
//collectionFormat = getCollectionFormat(s);
// default to csv:
Expand Down

0 comments on commit 7db0201

Please sign in to comment.