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 c95c95b28fa..3cecbc9347d 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 @@ -7227,10 +7227,6 @@ public class DefaultCodegen implements CodegenConfig { innerCp = innerCp.items; } - if (mostInnerItem == null) { - throw new RuntimeException("mostInnerItem (codegen property of array item) cannot be null. " + arraySchema); - } - if (StringUtils.isEmpty(bodyParameterName)) { if (StringUtils.isEmpty(mostInnerItem.complexType)) { codegenParameter.baseName = "request_body"; @@ -8147,7 +8143,9 @@ public class DefaultCodegen implements CodegenConfig { * @return Schema the input data converted to a Schema if possible */ protected Schema getSchemaFromBooleanOrSchema(Object schema) { - if (schema instanceof Boolean) { + if (schema == null) { + return null; + } else if (schema instanceof Boolean) { if (Boolean.TRUE.equals(schema)) { return trueSchema; } else if (Boolean.FALSE.equals(schema)) { @@ -8156,13 +8154,9 @@ public class DefaultCodegen implements CodegenConfig { // null case return null; } else if (schema instanceof Schema) { - if (schema == null) { - return null; - } return (Schema) schema; - } else if (schema == null) { - return null; + } else { + throw new IllegalArgumentException("Invalid schema type; type must be Boolean or Schema"); } - throw new IllegalArgumentException("Invalid schema type; type must be Boolean or Schema"); } }