diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java index 93e7efebf462..15aa485c8ae9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java @@ -807,6 +807,14 @@ private void processProducesConsumes(CodegenOperation op) { SetNoContent(op, X_INLINE_CONTENT_TYPE); } if (op.hasConsumes) { + // deduplicate + Map> consumes = new HashMap<>(); + for (Map m : op.consumes) { + consumes.put(m.get(MEDIA_TYPE), m); + } + op.consumes = new ArrayList<>(consumes.values()); + + // add metadata for (Map m : op.consumes) { processMediaType(op, m); processInlineConsumesContentType(op, m); @@ -817,6 +825,14 @@ private void processProducesConsumes(CodegenOperation op) { } } if (op.hasProduces) { + // deduplicate + Map> produces = new HashMap<>(); + for (Map m : op.produces) { + produces.put(m.get(MEDIA_TYPE), m); + } + op.produces = new ArrayList<>(produces.values()); + + // add metadata for (Map m : op.produces) { processMediaType(op, m); processInlineProducesContentType(op, m); @@ -920,8 +936,10 @@ private void addEnumToUniques(String paramNameType, String datatype, String enum private void processPathExpr(CodegenOperation op) { String xPath = "[\"" + escapeText(op.path) + "\"]"; if (op.getHasPathParams()) { - for (CodegenParameter param : op.pathParams) { - xPath = xPath.replaceAll("\\{" + param.baseName + "\\}", "\",toPath " + param.paramName + ",\""); + for (CodegenParameter param : op.allParams) { + if(param.isPathParam) { + xPath = xPath.replaceAll("\\{" + param.baseName + "\\}", "\",toPath " + param.paramName + ",\""); + } } xPath = xPath.replaceAll(",\"\",", ","); xPath = xPath.replaceAll("\"\",", ",");