From c5ae4609aca218346e3ef4d219ead17dae47119b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 6 Aug 2020 21:48:25 +0800 Subject: [PATCH 1/2] escape special characters in regular expression in csharp netcore client --- .../codegen/languages/CSharpNetCoreClientCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 2d2f563bf210..0e15ab1dd08c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -476,7 +476,7 @@ public void postProcessPattern(String pattern, Map vendorExtensi + "/pattern/modifiers convention. " + pattern + " is not valid."); } - String regex = pattern.substring(1, i).replace("'", "\'"); + String regex = escapeText(pattern.substring(1, i).replace("'", "\'")); List modifiers = new ArrayList(); // perl requires an explicit modifier to be culture specific and .NET is the reverse. From adad352c01535b22feef13d29923873c64b69c3a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 6 Aug 2020 22:26:20 +0800 Subject: [PATCH 2/2] escape double quote --- .../codegen/languages/CSharpNetCoreClientCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 0e15ab1dd08c..6288d267fd05 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -476,7 +476,7 @@ public void postProcessPattern(String pattern, Map vendorExtensi + "/pattern/modifiers convention. " + pattern + " is not valid."); } - String regex = escapeText(pattern.substring(1, i).replace("'", "\'")); + String regex = pattern.substring(1, i).replace("'", "\'").replace("\"", "\"\""); List modifiers = new ArrayList(); // perl requires an explicit modifier to be culture specific and .NET is the reverse.