diff --git a/src/Kiota.Builder/EqualityComparers/OpenApiServerComparer.cs b/src/Kiota.Builder/EqualityComparers/OpenApiServerComparer.cs index dca85c9a02..1a2333f79e 100644 --- a/src/Kiota.Builder/EqualityComparers/OpenApiServerComparer.cs +++ b/src/Kiota.Builder/EqualityComparers/OpenApiServerComparer.cs @@ -8,7 +8,7 @@ namespace Kiota.Builder.EqualityComparers; internal sealed partial class OpenApiServerComparer : IEqualityComparer<OpenApiServer> { - [GeneratedRegex("^https?://", RegexOptions.IgnoreCase | RegexOptions.Compiled, 200)] + [GeneratedRegex("^https?://", RegexOptions.IgnoreCase | RegexOptions.Compiled, 500)] private static partial Regex protocolCleanupRegex(); public bool Equals(OpenApiServer? x, OpenApiServer? y) { diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index f392e6ffc7..c6ad8bf182 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -13,7 +13,7 @@ public static partial class OpenApiUrlTreeNodeExtensions private static string GetDotIfBothNotNullOfEmpty(string x, string y) => string.IsNullOrEmpty(x) || string.IsNullOrEmpty(y) ? string.Empty : "."; private static readonly Func<string, string> replaceSingleParameterSegmentByItem = static x => x.IsPathSegmentWithSingleSimpleParameter() ? "item" : x; - private static readonly char[] namespaceNameSplitCharacters = new[] { '.', '-', '$' }; //$ref from OData + private static readonly char[] namespaceNameSplitCharacters = ['.', '-', '$']; //$ref from OData internal static string GetNamespaceFromPath(this string currentPath, string prefix) => prefix + ((currentPath?.Contains(PathNameSeparator, StringComparison.OrdinalIgnoreCase) ?? false) ? @@ -38,10 +38,10 @@ public static string GetNodeNamespaceFromPath(this OpenApiUrlTreeNode currentNod return currentNode.Path.GetNamespaceFromPath(prefix); } //{id}, name(idParam={id}), name(idParam='{id}'), name(idParam='{id}',idParam2='{id2}') - [GeneratedRegex(@"(?:\w+)?=?'?\{(?<paramName>\w+)\}'?,?", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"(?:\w+)?=?'?\{(?<paramName>\w+)\}'?,?", RegexOptions.Singleline, 500)] private static partial Regex PathParametersRegex(); // microsoft.graph.getRoleScopeTagsByIds(ids=@ids) - [GeneratedRegex(@"=@(\w+)", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"=@(\w+)", RegexOptions.Singleline, 500)] private static partial Regex AtSignPathParameterRegex(); private const char RequestParametersChar = '{'; private const char RequestParametersEndChar = '}'; @@ -81,7 +81,7 @@ public static IEnumerable<OpenApiParameter> GetPathParametersForCurrentSegment(t return Enumerable.Empty<OpenApiParameter>(); } private const char PathNameSeparator = '\\'; - [GeneratedRegex(@"-?id\d?}?$", RegexOptions.Singleline | RegexOptions.IgnoreCase, 200)] + [GeneratedRegex(@"-?id\d?}?$", RegexOptions.Singleline | RegexOptions.IgnoreCase, 500)] private static partial Regex idClassNameCleanup(); ///<summary> /// Returns the class name for the node with more or less precision depending on the provided arguments @@ -142,7 +142,7 @@ private static string GetSegmentName(this OpenApiUrlTreeNode currentNode, Struct "yml", "txt", }; - [GeneratedRegex(@"[\r\n\t]", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"[\r\n\t]", RegexOptions.Singleline, 500)] private static partial Regex descriptionCleanupRegex(); public static string CleanupDescription(this string? description) => string.IsNullOrEmpty(description) ? string.Empty : descriptionCleanupRegex().Replace(description, string.Empty); public static string GetPathItemDescription(this OpenApiUrlTreeNode currentNode, string label, string? defaultValue = default) @@ -174,9 +174,9 @@ private static bool IsPathSegmentWithNumberOfParameters(this string currentSegme return eval(currentSegment.Where(static x => x == RequestParametersChar)); } - [GeneratedRegex(@"\.(?:json|yaml|yml|csv|txt)$", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"\.(?:json|yaml|yml|csv|txt)$", RegexOptions.Singleline, 500)] private static partial Regex stripExtensionForIndexersRegex(); // so {param-name}.json is considered as indexer - [GeneratedRegex(@"\{\w+\}\.(?:json|yaml|yml|csv|txt)$", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"\{\w+\}\.(?:json|yaml|yml|csv|txt)$", RegexOptions.Singleline, 500)] private static partial Regex stripExtensionForIndexersTestRegex(); // so {param-name}.json is considered as indexer public static bool IsComplexPathMultipleParameters(this OpenApiUrlTreeNode currentNode) => (currentNode?.Segment?.IsPathSegmentWithNumberOfParameters(static x => x.Any()) ?? false) && !currentNode.IsPathSegmentWithSingleSimpleParameter(); @@ -215,7 +215,7 @@ public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode) SanitizePathParameterNamesForUrlTemplate(currentNode.Path.Replace('\\', '/'), pathReservedPathParametersIds) + queryStringParameters; } - [GeneratedRegex(@"{(?<paramname>[^}]+)}", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"{(?<paramname>[^}]+)}", RegexOptions.Singleline, 500)] private static partial Regex pathParamMatcher(); private static string SanitizePathParameterNamesForUrlTemplate(string original, HashSet<string> reservedParameterNames) { @@ -236,7 +236,7 @@ public static string SanitizeParameterNameForUrlTemplate(this string original) .Replace(".", "%2E", StringComparison.OrdinalIgnoreCase) .Replace("~", "%7E", StringComparison.OrdinalIgnoreCase);// - . ~ are invalid uri template character but don't get encoded by Uri.EscapeDataString } - [GeneratedRegex(@"%[0-9A-F]{2}", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"%[0-9A-F]{2}", RegexOptions.Singleline, 500)] private static partial Regex removePctEncodedCharacters(); public static string SanitizeParameterNameForCodeSymbols(this string original, string replaceEncodedCharactersWith = "") { diff --git a/src/Kiota.Builder/Extensions/StringExtensions.cs b/src/Kiota.Builder/Extensions/StringExtensions.cs index c9b96fa4be..8266834bcd 100644 --- a/src/Kiota.Builder/Extensions/StringExtensions.cs +++ b/src/Kiota.Builder/Extensions/StringExtensions.cs @@ -149,7 +149,7 @@ public static string ReplaceDotsWithSlashInNamespaces(this string? namespaced) ///<summary> /// Cleanup regex that removes all special characters from ASCII 0-127 ///</summary> - [GeneratedRegex(@"[""\s!#$%&'()*,./:;<=>?@\[\]\\^`’{}|~-](?<followingLetter>\w)?", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"[""\s!#$%&'()*,./:;<=>?@\[\]\\^`’{}|~-](?<followingLetter>\w)?", RegexOptions.Singleline, 500)] private static partial Regex propertyCleanupRegex(); private const string CleanupGroupName = "followingLetter"; public static string CleanupSymbolName(this string? original) @@ -181,7 +181,7 @@ public static string CleanupSymbolName(this string? original) return result; } - [GeneratedRegex(@"^(?<number>\d+)", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"^(?<number>\d+)", RegexOptions.Singleline, 500)] private static partial Regex NumbersSpellingRegex(); private static readonly Dictionary<char, string> SpelledOutNumbers = new() { {'0', "Zero"}, diff --git a/src/Kiota.Builder/Refiners/RubyRefiner.cs b/src/Kiota.Builder/Refiners/RubyRefiner.cs index c149c036db..70cc37070f 100644 --- a/src/Kiota.Builder/Refiners/RubyRefiner.cs +++ b/src/Kiota.Builder/Refiners/RubyRefiner.cs @@ -196,7 +196,7 @@ parameterType.TypeDefinition is CodeClass parameterTypeClass && } CrawlTree(currentElement, x => UpdateReferencesToDisambiguatedClasses(x, classesToUpdate, suffix)); } - [GeneratedRegex(@"\\.(<letter>\\w)", RegexOptions.IgnoreCase | RegexOptions.Singleline, 200)] + [GeneratedRegex(@"\\.(<letter>\\w)", RegexOptions.IgnoreCase | RegexOptions.Singleline, 500)] private static partial Regex CapitalizedFirstLetterAfterDot(); private static void FlattenModelsNamespaces(CodeElement currentElement, CodeNamespace modelsNS) { diff --git a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs index 6db19ff200..dc9c76c3fc 100644 --- a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs @@ -881,10 +881,10 @@ private static string NormalizeToOption(string input) return result.ToLowerInvariant(); } - [GeneratedRegex("(?<=[a-z])[-_\\.]+([A-Za-z])", RegexOptions.Singleline, 200)] + [GeneratedRegex("(?<=[a-z])[-_\\.]+([A-Za-z])", RegexOptions.Singleline, 500)] private static partial Regex DelimitedRegex(); - [GeneratedRegex("(?<=[a-z])([A-Z])", RegexOptions.Singleline, 200)] + [GeneratedRegex("(?<=[a-z])([A-Z])", RegexOptions.Singleline, 500)] private static partial Regex CamelCaseRegex(); - [GeneratedRegex("([A-Z])", RegexOptions.Singleline, 200)] + [GeneratedRegex("([A-Z])", RegexOptions.Singleline, 500)] private static partial Regex UppercaseRegex(); } diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index 8711bd64ff..e736e15248 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -145,7 +145,7 @@ private void WriteFactoryMethodBody(CodeMethod codeElement, CodeClass parentClas else writer.WriteLine($"return new {parentClass.Name}();"); } - [GeneratedRegex(@"_(?<idx>\d+)", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"_(?<idx>\d+)", RegexOptions.Singleline, 500)] private static partial Regex factoryMethodIndexParser(); private static void WriteFactoryOverloadMethod(CodeMethod codeElement, CodeClass parentClass, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs index 8258d9b438..7d7d749cad 100644 --- a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs +++ b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs @@ -122,7 +122,7 @@ public void WriteLongDescription(CodeElement element, LanguageWriter writer, IEn writer.WriteLine(DocCommentEnd); } } - [GeneratedRegex(@"[^\u0000-\u007F]+", RegexOptions.None, 200)] + [GeneratedRegex(@"[^\u0000-\u007F]+", RegexOptions.None, 500)] private static partial Regex nonAsciiReplaceRegex(); internal static string RemoveInvalidDescriptionCharacters(string originalDescription) => string.IsNullOrEmpty(originalDescription) ? diff --git a/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs index 29a171766c..b85e876273 100644 --- a/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeEnumWriter.cs @@ -50,7 +50,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.WriteLine($"public const {GetEnumValueName(enumProperty.Name)} = '{enumProperty.WireName}';"); } } - [GeneratedRegex(@"([A-Z]{1})", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"([A-Z]{1})", RegexOptions.Singleline, 500)] private static partial Regex _enumValueNameRegex(); private static string GetEnumValueName(string original) { diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index df65ef687b..d62b428369 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -315,9 +315,9 @@ private static Option<string> GetManifestOption(string defaultValue) manifestOption.AddAlias("-a"); return manifestOption; } - [GeneratedRegex(@"^[a-zA-Z_][\w_-]+", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"^[a-zA-Z_][\w_-]+", RegexOptions.Singleline, 500)] private static partial Regex classNameRegex(); - [GeneratedRegex(@"^[\w][\w\._-]+", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"^[\w][\w\._-]+", RegexOptions.Singleline, 500)] private static partial Regex namespaceNameRegex(); private static Command GetGenerateCommand() { diff --git a/src/kiota/Rpc/Server.cs b/src/kiota/Rpc/Server.cs index 15f29f1ff9..1db32d1ecc 100644 --- a/src/kiota/Rpc/Server.cs +++ b/src/kiota/Rpc/Server.cs @@ -133,7 +133,7 @@ private static IEnumerable<string> GetOperationsFromTreeNode(OpenApiUrlTreeNode Enumerable.Empty<string>()) .Union(node.Children.SelectMany(static x => GetOperationsFromTreeNode(x.Value))); } - [GeneratedRegex(@"{\w+}", RegexOptions.Singleline, 200)] + [GeneratedRegex(@"{\w+}", RegexOptions.Singleline, 500)] private static partial Regex indexingNormalizationRegex(); private static string NormalizeOperationNodePath(OpenApiUrlTreeNode node, OperationType operationType, bool forIndexing = false) {