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 fbbfae50a3bf..a78e9a703cae 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 @@ -1182,12 +1182,19 @@ private static boolean isMultipartOperation(List> consumes) @Override public String toVarName(String name) { + if (nameMapping.containsKey(name)) { + return nameMapping.get(name); + } + return toVarName("", name); } public String toVarName(String prefix, String name) { boolean hasPrefix = !StringUtils.isBlank(prefix); name = underscore(sanitizeName(name.replaceAll("-", "_"))); + if (name.equals("_")) { + name = "underscore"; + } name = camelize(name, hasPrefix ? UPPERCASE_FIRST_CHAR : LOWERCASE_FIRST_LETTER); if (hasPrefix) { @@ -1203,6 +1210,10 @@ public String toVarName(String prefix, String name) { @Override public String toParamName(String name) { + if (parameterNameMapping.containsKey(name)) { + return parameterNameMapping.get(name); + } + return toVarName(name); } diff --git a/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache b/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache index e910264bdd0a..3ed2df43812b 100644 --- a/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache +++ b/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache @@ -14,6 +14,7 @@ Module : {{baseModule}}.Core {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs index 9062b81abfcf..b94edcc77570 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs @@ -23,6 +23,7 @@ Module : OpenAPIPetstore.Core {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}