diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index 08007ff72d..f392e6ffc7 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -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+)?=?'?\{(?\w+)\}'?,?", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"(?:\w+)?=?'?\{(?\w+)\}'?,?", RegexOptions.Singleline, 200)] private static partial Regex PathParametersRegex(); // microsoft.graph.getRoleScopeTagsByIds(ids=@ids) - [GeneratedRegex(@"=@(\w+)", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"=@(\w+)", RegexOptions.Singleline, 200)] private static partial Regex AtSignPathParameterRegex(); private const char RequestParametersChar = '{'; private const char RequestParametersEndChar = '}'; @@ -81,7 +81,7 @@ public static IEnumerable GetPathParametersForCurrentSegment(t return Enumerable.Empty(); } private const char PathNameSeparator = '\\'; - [GeneratedRegex(@"-?id\d?}?$", RegexOptions.Singleline | RegexOptions.IgnoreCase, 100)] + [GeneratedRegex(@"-?id\d?}?$", RegexOptions.Singleline | RegexOptions.IgnoreCase, 200)] private static partial Regex idClassNameCleanup(); /// /// 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, 100)] + [GeneratedRegex(@"[\r\n\t]", RegexOptions.Singleline, 200)] 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, 100)] + [GeneratedRegex(@"\.(?:json|yaml|yml|csv|txt)$", RegexOptions.Singleline, 200)] private static partial Regex stripExtensionForIndexersRegex(); // so {param-name}.json is considered as indexer - [GeneratedRegex(@"\{\w+\}\.(?:json|yaml|yml|csv|txt)$", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"\{\w+\}\.(?:json|yaml|yml|csv|txt)$", RegexOptions.Singleline, 200)] 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(@"{(?[^}]+)}", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"{(?[^}]+)}", RegexOptions.Singleline, 200)] private static partial Regex pathParamMatcher(); private static string SanitizePathParameterNamesForUrlTemplate(string original, HashSet 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, 100)] + [GeneratedRegex(@"%[0-9A-F]{2}", RegexOptions.Singleline, 200)] 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 ad1c39f28d..c9b96fa4be 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) /// /// Cleanup regex that removes all special characters from ASCII 0-127 /// - [GeneratedRegex(@"[""\s!#$%&'()*,./:;<=>?@\[\]\\^`’{}|~-](?\w)?", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"[""\s!#$%&'()*,./:;<=>?@\[\]\\^`’{}|~-](?\w)?", RegexOptions.Singleline, 200)] 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(@"^(?\d+)", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"^(?\d+)", RegexOptions.Singleline, 200)] private static partial Regex NumbersSpellingRegex(); private static readonly Dictionary SpelledOutNumbers = new() { {'0', "Zero"}, diff --git a/src/Kiota.Builder/Refiners/RubyRefiner.cs b/src/Kiota.Builder/Refiners/RubyRefiner.cs index e0c5913ac4..c149c036db 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(@"\\.(\\w)", RegexOptions.IgnoreCase | RegexOptions.Singleline, 100)] + [GeneratedRegex(@"\\.(\\w)", RegexOptions.IgnoreCase | RegexOptions.Singleline, 200)] 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 bf0026bda6..6db19ff200 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, 100)] + [GeneratedRegex("(?<=[a-z])[-_\\.]+([A-Za-z])", RegexOptions.Singleline, 200)] private static partial Regex DelimitedRegex(); - [GeneratedRegex("(?<=[a-z])([A-Z])", RegexOptions.Singleline, 100)] + [GeneratedRegex("(?<=[a-z])([A-Z])", RegexOptions.Singleline, 200)] private static partial Regex CamelCaseRegex(); - [GeneratedRegex("([A-Z])", RegexOptions.Singleline, 100)] + [GeneratedRegex("([A-Z])", RegexOptions.Singleline, 200)] private static partial Regex UppercaseRegex(); } diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index 02693baf95..8711bd64ff 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(@"_(?\d+)", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"_(?\d+)", RegexOptions.Singleline, 200)] 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 8ce6ee9805..8258d9b438 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, 100)] + [GeneratedRegex(@"[^\u0000-\u007F]+", RegexOptions.None, 200)] 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 ff583687ab..29a171766c 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, 100)] + [GeneratedRegex(@"([A-Z]{1})", RegexOptions.Singleline, 200)] private static partial Regex _enumValueNameRegex(); private static string GetEnumValueName(string original) { diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index 7541d52f7f..df65ef687b 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -315,9 +315,9 @@ private static Option GetManifestOption(string defaultValue) manifestOption.AddAlias("-a"); return manifestOption; } - [GeneratedRegex(@"^[a-zA-Z_][\w_-]+", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"^[a-zA-Z_][\w_-]+", RegexOptions.Singleline, 200)] private static partial Regex classNameRegex(); - [GeneratedRegex(@"^[\w][\w\._-]+", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"^[\w][\w\._-]+", RegexOptions.Singleline, 200)] private static partial Regex namespaceNameRegex(); private static Command GetGenerateCommand() { diff --git a/src/kiota/Rpc/Server.cs b/src/kiota/Rpc/Server.cs index 97a54d9ae5..15f29f1ff9 100644 --- a/src/kiota/Rpc/Server.cs +++ b/src/kiota/Rpc/Server.cs @@ -133,7 +133,7 @@ private static IEnumerable GetOperationsFromTreeNode(OpenApiUrlTreeNode Enumerable.Empty()) .Union(node.Children.SelectMany(static x => GetOperationsFromTreeNode(x.Value))); } - [GeneratedRegex(@"{\w+}", RegexOptions.Singleline, 100)] + [GeneratedRegex(@"{\w+}", RegexOptions.Singleline, 200)] private static partial Regex indexingNormalizationRegex(); private static string NormalizeOperationNodePath(OpenApiUrlTreeNode node, OperationType operationType, bool forIndexing = false) {