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 03d0daf8198..357d2197cd9 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 a312a586bfa..5d088a4aed4 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 048a2ccaea8..7c70740b5f3 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 00ce4324ade..e58706bfa7d 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 c0472474f38..b15038a3fa3 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 e32225985dd..0f6a46e313a 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 00ce4324ade..e58706bfa7d 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 26d830ef2bd..382636b9c59 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 a8adff38c91..9d704244ca6 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 048a2ccaea8..7c70740b5f3 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 00ce4324ade..e58706bfa7d 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 c0472474f38..b15038a3fa3 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 e32225985dd..0f6a46e313a 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 00ce4324ade..e58706bfa7d 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 26d830ef2bd..382636b9c59 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 a8adff38c91..9d704244ca6 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 ce9f6af2b94..ea0ca69d6ac 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 17060612c0b..2406e1ca007 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 b19e837fb7e..0de5dc0426d 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 9ae6e1089dd..895f77e556b 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 ccd977d4972..8a3b1e1511b 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 17060612c0b..2406e1ca007 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 850c6c95f3c..91be9bd4c0f 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 ccd977d4972..8a3b1e1511b 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 4cdf0f20612..7f26eb170dd 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 ce9f6af2b94..ea0ca69d6ac 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 17060612c0b..2406e1ca007 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 b19e837fb7e..0de5dc0426d 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 9ae6e1089dd..895f77e556b 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 ccd977d4972..8a3b1e1511b 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 17060612c0b..2406e1ca007 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 850c6c95f3c..91be9bd4c0f 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 ccd977d4972..8a3b1e1511b 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 4cdf0f20612..7f26eb170dd 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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 @@ namespace Org.OpenAPITools.Client { 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 26d830ef2bd..382636b9c59 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 @@ namespace Org.OpenAPITools.Client } } - /// - /// 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 @@ namespace Org.OpenAPITools.Client /// /// 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.