diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java index 115e05ea06b..66b85ff9e81 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java @@ -189,7 +189,6 @@ public class OpenAPINormalizer { normalizePaths(); normalizeComponentsSchemas(); - normalizeComponentsResponses(); } /** @@ -320,9 +319,8 @@ public class OpenAPINormalizer { if (responsesEntry.getValue() == null) { continue; } else { - normalizeContent(responsesEntry.getValue().getContent()); - normalizeHeaders(responsesEntry.getValue().getHeaders()); - + normalizeContent(ModelUtils.getReferencedApiResponse(openAPI, responsesEntry.getValue()).getContent()); + normalizeHeaders(ModelUtils.getReferencedApiResponse(openAPI, responsesEntry.getValue()).getHeaders()); } } } @@ -365,33 +363,6 @@ public class OpenAPINormalizer { } } - /** - * Normalizes responses in components - */ - private void normalizeComponentsResponses() { - Map schemas = openAPI.getComponents().getResponses(); - if (schemas == null) { - return; - } - - List schemaNames = new ArrayList(schemas.keySet()); - for (String schemaName : schemaNames) { - ApiResponse schema = schemas.get(schemaName); - if (schema == null) { - LOGGER.warn("{} not fount found in openapi/components/schemas.", schemaName); - } else { - Content content = ModelUtils.getReferencedApiResponse(openAPI, schema).getContent(); - if (content == null || content.isEmpty()) { - continue; - } - for (Map.Entry entry : content.entrySet()) { - Schema entryResult = normalizeSchema(entry.getValue().getSchema(), new HashSet<>()); - entry.getValue().setSchema(entryResult); - } - } - } - } - /** * Normalizes a schema *