diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache
index 03d0daf81986..357d2197cd97 100644
--- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache
@@ -24,7 +24,7 @@ using System.Runtime.CompilerServices;
///
/// Utility functions providing some benefit to API client consumers.
///
- {{>visibility}} static class ClientUtils
+ {{>visibility}} static {{#net70OrLater}}partial {{/net70OrLater}}class ClientUtils
{
{{#useCompareNetObjects}}
///
@@ -143,17 +143,6 @@ using System.Runtime.CompilerServices;
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -325,7 +314,13 @@ using System.Runtime.CompilerServices;
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ {{#net70OrLater}}
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
+ {{/net70OrLater}}
+ {{^net70OrLater}}
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ {{/net70OrLater}}
///
/// Check if the given MIME is a JSON MIME.
@@ -341,7 +336,7 @@ using System.Runtime.CompilerServices;
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return {{#net70OrLater}}JsonRegex(){{/net70OrLater}}{{^net70OrLater}}JsonRegex{{/net70OrLater}}.IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs
index a312a586bfa5..5d088a4aed4d 100644
--- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -27,7 +27,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
@@ -109,17 +109,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -260,7 +249,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -276,7 +266,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 048a2ccaea85..7c70740b5f30 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -96,17 +96,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -245,7 +234,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 00ce4324ade8..e58706bfa7d4 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -96,17 +96,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -245,7 +234,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
index c0472474f383..b15038a3fa36 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -81,17 +81,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -230,7 +219,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index e32225985dda..0f6a46e313a2 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -130,17 +130,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -345,7 +334,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 00ce4324ade8..e58706bfa7d4 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -96,17 +96,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -245,7 +234,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 26d830ef2bd1..382636b9c592 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -130,17 +130,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -349,7 +338,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
index a8adff38c919..9d704244ca60 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -81,17 +81,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -230,7 +219,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 048a2ccaea85..7c70740b5f30 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -96,17 +96,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -245,7 +234,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 00ce4324ade8..e58706bfa7d4 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -96,17 +96,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -245,7 +234,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
index c0472474f383..b15038a3fa36 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -81,17 +81,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -230,7 +219,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index e32225985dda..0f6a46e313a2 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -130,17 +130,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -345,7 +334,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 00ce4324ade8..e58706bfa7d4 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -96,17 +96,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -245,7 +234,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 26d830ef2bd1..382636b9c592 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -130,17 +130,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -349,7 +338,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
index a8adff38c919..9d704244ca60 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -81,17 +81,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -230,7 +219,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index ce9f6af2b941..ea0ca69d6ace 100644
--- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -98,17 +98,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -249,7 +238,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -265,7 +255,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 17060612c0b4..2406e1ca0078 100644
--- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -98,17 +98,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -249,7 +238,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -265,7 +255,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
index b19e837fb7e6..0de5dc0426d7 100644
--- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -27,7 +27,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
@@ -83,17 +83,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -234,7 +223,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -250,7 +240,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index 9ae6e1089ddf..895f77e556ba 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -26,7 +26,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -127,17 +127,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -344,7 +333,8 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -360,7 +350,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
index ccd977d49725..8a3b1e1511b2 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -129,17 +129,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -350,7 +339,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -366,7 +356,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 17060612c0b4..2406e1ca0078 100644
--- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -98,17 +98,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -249,7 +238,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -265,7 +255,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 850c6c95f3ca..91be9bd4c0f8 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -26,7 +26,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -127,17 +127,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -348,7 +337,8 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -364,7 +354,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
index ccd977d49725..8a3b1e1511b2 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -129,17 +129,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -350,7 +339,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -366,7 +356,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
index 4cdf0f206124..7f26eb170ddc 100644
--- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -27,7 +27,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
@@ -83,17 +83,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -234,7 +223,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -250,7 +240,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index ce9f6af2b941..ea0ca69d6ace 100644
--- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -98,17 +98,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -249,7 +238,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -265,7 +255,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 17060612c0b4..2406e1ca0078 100644
--- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -98,17 +98,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -249,7 +238,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -265,7 +255,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
index b19e837fb7e6..0de5dc0426d7 100644
--- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -27,7 +27,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
@@ -83,17 +83,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -234,7 +223,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -250,7 +240,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index 9ae6e1089ddf..895f77e556ba 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -26,7 +26,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -127,17 +127,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -344,7 +333,8 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -360,7 +350,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
index ccd977d49725..8a3b1e1511b2 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -129,17 +129,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -350,7 +339,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -366,7 +356,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
index 17060612c0b4..2406e1ca0078 100644
--- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -98,17 +98,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -249,7 +238,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -265,7 +255,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 850c6c95f3ca..91be9bd4c0f8 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -26,7 +26,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -127,17 +127,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -348,7 +337,8 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -364,7 +354,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
index ccd977d49725..8a3b1e1511b2 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -28,7 +28,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
/// An instance of CompareLogic.
@@ -129,17 +129,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -350,7 +339,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -366,7 +356,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
index 4cdf0f206124..7f26eb170ddc 100644
--- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -27,7 +27,7 @@ namespace Org.OpenAPITools.Client
///
/// Utility functions providing some benefit to API client consumers.
///
- public static class ClientUtils
+ public static partial class ClientUtils
{
///
@@ -83,17 +83,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -234,7 +223,8 @@ public static byte[] ReadAsBytes(Stream inputStream)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ [GeneratedRegex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")]
+ private static partial Regex JsonRegex();
///
/// Check if the given MIME is a JSON MIME.
@@ -250,7 +240,7 @@ public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
- return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
+ return JsonRegex().IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 26d830ef2bd1..382636b9c592 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -130,17 +130,6 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
}
}
- ///
- /// Sanitize filename by removing the path
- ///
- /// Filename
- /// Filename
- public static string SanitizeFilename(string filename)
- {
- Match match = Regex.Match(filename, @".*[/\\](.*)$");
- return match.Success ? match.Groups[1].Value : filename;
- }
-
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
@@ -349,7 +338,7 @@ public static string SelectHeaderAccept(string[] accepts)
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
- public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
+ private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.