diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index 45c883722b7..91cfe4f3482 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -120,7 +120,7 @@ public class InlineModelResolver { for (Map.Entry pathsEntry : paths.entrySet()) { PathItem path = pathsEntry.getValue(); - Map operationsMap = new LinkedHashMap<>(path.readOperationsMap()); + List> toFlatten = new ArrayList<>(path.readOperationsMap().entrySet()); // use path name (e.g. /foo/bar) and HTTP verb to come up with a name // in case operationId is not defined later in other methods @@ -135,13 +135,13 @@ public class InlineModelResolver { Callback callback = callbackEntry.getValue(); for (Map.Entry pathItemEntry : callback.entrySet()) { PathItem pathItem = pathItemEntry.getValue(); - operationsMap.putAll(pathItem.readOperationsMap()); + toFlatten.addAll(pathItem.readOperationsMap().entrySet()); } } } } - for (Map.Entry operationEntry : operationsMap.entrySet()) { + for (Map.Entry operationEntry : toFlatten) { Operation operation = operationEntry.getValue(); String inlineSchemaName = this.getInlineSchemaName(operationEntry.getKey(), pathname); flattenRequestBody(inlineSchemaName, operation);