Skip to content

Commit 37e142e

Browse files
committed
fix implementation
1 parent 9165605 commit 37e142e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,10 +1187,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
11871187
@Override
11881188
@SuppressWarnings("unused")
11891189
public void processOpenAPI(OpenAPI openAPI) {
1190-
LinkedHashMap<String, Operation> operationsByOperationId = openAPI.getPaths().entrySet().stream()
1190+
Map<String, Operation> operationsByOperationId = openAPI.getPaths() != null
1191+
? openAPI.getPaths().entrySet().stream()
11911192
.flatMap(path -> path.getValue().readOperations().stream())
1192-
.collect(Collectors.toMap(Operation::getOperationId, Function.identity(), (existing, replacement) -> existing, LinkedHashMap::new));
1193-
Map<String, Schema> modelsByName = openAPI.getComponents().getSchemas();
1193+
.collect(Collectors.toMap(Operation::getOperationId, Function.identity(), (existing, replacement) -> existing, LinkedHashMap::new))
1194+
: Map.of();
1195+
Map<String, Schema> modelsByName = (openAPI.getComponents() != null && openAPI.getComponents().getSchemas() != null)
1196+
? openAPI.getComponents().getSchemas()
1197+
: Map.of();
11941198

11951199
// Remove model vendor extensions
11961200
modelVendorExtensionRemove.forEach((name, ext) -> {

0 commit comments

Comments
 (0)