diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 3539f1674c..2a700ad9d8 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -358,12 +358,12 @@ private static Dictionary> GetFilterPatternsFromCon internal static void CleanupOperationIdForPlugins(OpenApiDocument document) { if (document.Paths is null) return; - foreach (var (pathItem, operation) in document.Paths.SelectMany(path => path.Value.Operations.Select(value => new Tuple>(path.Key, value)))) + foreach (var (pathItem, operation) in document.Paths.SelectMany(static path => path.Value.Operations.Select(value => new Tuple>(path.Key, value)))) { if (string.IsNullOrEmpty(operation.Value.OperationId)) { var stringBuilder = new StringBuilder(); - foreach (var segment in pathItem.Split('/')) + foreach (var segment in pathItem.TrimStart('/').Split('/',StringSplitOptions.RemoveEmptyEntries)) { if (segment.IsPathSegmentWithSingleSimpleParameter()) stringBuilder.Append("item");