mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 15:51:38 +00:00
[haskell-servant][haskell-yesod] fix specialCharReplacements (#16289)
HaskellServantCodegen and HaskellYesodServerCodegen modify
specialCharReplacements by replacing its keys: backslash ("\\") with
"\\\\" and "\"" with "\\\"".
It seems that those replacements were for using the keys in string
literals in the specialChars table in the generated code. However,
modifying the keys causes the substitution of those characters in
field names not to work, making generated code syntactically invalid.
Since the specialChars table has already been removed, we can safely
stop modifying the specialCharReplacements.
This commit is contained in:
@@ -114,12 +114,6 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
specialCharReplacements.put(">", "GreaterThan");
|
||||
specialCharReplacements.put("<", "LessThan");
|
||||
|
||||
// backslash and double quote need double the escapement for both Java and Haskell
|
||||
specialCharReplacements.remove("\\");
|
||||
specialCharReplacements.remove("\"");
|
||||
specialCharReplacements.put("\\\\", "Back_Slash");
|
||||
specialCharReplacements.put("\\\"", "Double_Quote");
|
||||
|
||||
// set the output folder here
|
||||
outputFolder = "generated-code/haskell-servant";
|
||||
|
||||
|
||||
@@ -108,12 +108,6 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
specialCharReplacements.put(">", "GreaterThan");
|
||||
specialCharReplacements.put("<", "LessThan");
|
||||
|
||||
// backslash and double quote need double the escapement for both Java and Haskell
|
||||
specialCharReplacements.remove("\\");
|
||||
specialCharReplacements.remove("\"");
|
||||
specialCharReplacements.put("\\\\", "Back_Slash");
|
||||
specialCharReplacements.put("\\\"", "Double_Quote");
|
||||
|
||||
outputFolder = "generated-code" + File.separator + "haskell-yesod";
|
||||
apiTemplateFiles.put("api.mustache", ".hs");
|
||||
apiTestTemplateFiles.put("api_test.mustache", ".hs");
|
||||
|
||||
Reference in New Issue
Block a user