Skip to content

Commit

Permalink
Merge pull request #4960 from microsoft/andrueastman/fixMissingNodes
Browse files Browse the repository at this point in the history
Fixes unselected paths where no children operations exists
  • Loading branch information
andrueastman authored Jul 11, 2024
2 parents a2a205d + 10dd282 commit 4fc7dd3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/kiota/Rpc/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ private static PathItem ConvertOpenApiUrlTreeNodeToPathItem(OpenApiUrlTreeNode n
.OrderByDescending(static x => x.isOperation)
.ThenBy(static x => x.segment, StringComparer.OrdinalIgnoreCase)
.ToArray();
return new PathItem(node.Path, node.DeduplicatedSegment(), children, filteredPaths.Count == 0 || Array.Exists(children, static x => x.isOperation) && children.Where(static x => x.isOperation).All(static x => x.selected));
bool isSelected = filteredPaths.Count == 0 || // There are no filtered paths
Array.Exists(children, static x => x.isOperation) && children.Where(static x => x.isOperation).All(static x => x.selected) || // All operations have been selected
!Array.Exists(children, static x => x.isOperation) && Array.TrueForAll(children, static x => x.selected); // All paths selected but no operations present
return new PathItem(node.Path, node.DeduplicatedSegment(), children, isSelected);
}
private static string GetAbsolutePath(string source)
{
Expand Down

0 comments on commit 4fc7dd3

Please sign in to comment.