diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 471b8c7122d6..d3e211aabbe6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1459,7 +1459,7 @@ public CodegenModel fromModel(String name, Schema schema, Map 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 interfaces = getInterfaces(composed); @@ -4097,7 +4097,12 @@ public List 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: