Skip to content

Commit 3a2b4b9

Browse files
authored
better null check in default codegen (#13264)
1 parent 1a5d392 commit 3a2b4b9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

+8
Original file line numberDiff line numberDiff line change
@@ -6926,6 +6926,10 @@ protected void updateRequestBodyForArray(CodegenParameter codegenParameter, Sche
69266926
final ArraySchema arraySchema = (ArraySchema) schema;
69276927
Schema inner = getSchemaItems(arraySchema);
69286928
CodegenProperty codegenProperty = fromProperty("property", arraySchema, false);
6929+
if (codegenProperty == null) {
6930+
throw new RuntimeException("CodegenProperty cannot be null. arraySchema for debugging: " + arraySchema);
6931+
}
6932+
69296933
if (!addSchemaImportsFromV3SpecLocations) {
69306934
imports.add(codegenProperty.baseType);
69316935
}
@@ -6943,6 +6947,10 @@ protected void updateRequestBodyForArray(CodegenParameter codegenParameter, Sche
69436947
innerCp = innerCp.items;
69446948
}
69456949

6950+
if (mostInnerItem == null) {
6951+
throw new RuntimeException("mostInnerItem (codegen property of array item) cannot be null. " + arraySchema);
6952+
}
6953+
69466954
if (StringUtils.isEmpty(bodyParameterName)) {
69476955
if (StringUtils.isEmpty(mostInnerItem.complexType)) {
69486956
codegenParameter.baseName = "request_body";

0 commit comments

Comments
 (0)