From 5c04f1bf7903177c89bdb8427c6a98b5e4f4dbbe Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Tue, 2 Dec 2025 13:27:55 -0500 Subject: [PATCH 1/4] Update to .NET 10 --- .vscode/launch.json | 6 +++--- src/CheckCloudSupport.csproj | 4 ++-- test/CheckCloudSupportTests.csproj | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a7b8135..d1ec525 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/src/bin/Debug/net9.0/CheckCloudSupport.dll", + "program": "${workspaceFolder}/src/bin/Debug/net10.0/CheckCloudSupport.dll", "args": [ "--open-api", "C:/Source/Repos/msgraph-metadata/schemas/openapi/v1.0", @@ -33,7 +33,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/src/bin/Debug/net9.0/CheckCloudSupport.dll", + "program": "${workspaceFolder}/src/bin/Debug/net10.0/CheckCloudSupport.dll", "args": [ "--open-api", "C:/Source/Repos/msgraph-metadata/schemas/openapi/beta", @@ -59,7 +59,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/src/bin/Debug/net9.0/CheckCloudSupport.dll", + "program": "${workspaceFolder}/src/bin/Debug/net10.0/CheckCloudSupport.dll", "args": [ "--help" ], diff --git a/src/CheckCloudSupport.csproj b/src/CheckCloudSupport.csproj index d1b0d1a..4b9785c 100644 --- a/src/CheckCloudSupport.csproj +++ b/src/CheckCloudSupport.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable true @@ -14,7 +14,7 @@ - + diff --git a/test/CheckCloudSupportTests.csproj b/test/CheckCloudSupportTests.csproj index 69d624d..b459eae 100644 --- a/test/CheckCloudSupportTests.csproj +++ b/test/CheckCloudSupportTests.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable From c4063eebb5f3a9b5ac2502021bf45fc2fbd871ab Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Tue, 2 Dec 2025 13:29:30 -0500 Subject: [PATCH 2/4] Fix for namespace in API endpoint mismatch Some APIs include a type specifier in the URL, like `microsoft.graph.sitePage`. For some of these, the OpenAPI that gets generated shortens this to `graph.sitePage`. This was causing a match to not be found. Added logic to try the shortened version if no match is found with the original. --- .../OpenApiUrlTreeNodeExtensions.cs | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Extensions/OpenApiUrlTreeNodeExtensions.cs index cf8e124..939484a 100644 --- a/src/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -35,29 +35,45 @@ public static class OpenApiUrlTreeNodeExtensions OpenApiUrlTreeNode result = parentNode; foreach (var segment in pathParts) { + var segmentToMatch = segment; OpenApiUrlTreeNode? nextNode = null; - if (segment == "{id}") + if (segmentToMatch == "{id}") { nextNode = result.Children.FirstOrDefault(c => c.Value.Segment.StartsWith('{') && c.Value.Segment.EndsWith('}') && c.Value.Segment.Contains("id", StringComparison.InvariantCultureIgnoreCase)).Value; } else { - var matchNodes = result.Children.Where(c => c.Value.Segment.IsEqualIgnoringCase(segment) || - c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segment}") || - c.Value.Segment.IsEqualIgnoringCase($"{segment}()") || - c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segment}()")); + var matchNodes = result.Children.Where(c => c.Value.Segment.IsEqualIgnoringCase(segmentToMatch) || + c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segmentToMatch}") || + c.Value.Segment.IsEqualIgnoringCase($"{segmentToMatch}()") || + c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segmentToMatch}()")); + + if (matchNodes?.Count() == 0 && + segmentToMatch.StartsWith("microsoft.graph", StringComparison.InvariantCultureIgnoreCase)) + { + // OpenAPI docs sometimes leave off the "microsoft." prefix + var trimmedSegment = segmentToMatch.Replace("microsoft.", string.Empty, StringComparison.InvariantCultureIgnoreCase); + + matchNodes = result.Children.Where(c => c.Value.Segment.IsEqualIgnoringCase(trimmedSegment) || + c.Value.Segment.IsEqualIgnoringCase($"{trimmedSegment}()")); + + if (matchNodes?.Count() >= 1) + { + segmentToMatch = trimmedSegment; + } + } if (matchNodes?.Count() > 1) { var matchCount = matchNodes.Count(); } - nextNode = result.Children.FirstOrDefault(c => c.Value.Segment.IsEqualIgnoringCase(segment) || - c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segment}")).Value ?? - result.Children.FirstOrDefault(c => c.Value.Segment.IsEqualIgnoringCase($"{segment}()") || - c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segment}()")).Value; + nextNode = result.Children.FirstOrDefault(c => c.Value.Segment.IsEqualIgnoringCase(segmentToMatch) || + c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segmentToMatch}")).Value ?? + result.Children.FirstOrDefault(c => c.Value.Segment.IsEqualIgnoringCase($"{segmentToMatch}()") || + c.Value.Segment.IsEqualIgnoringCase($"{graphNamespace}.{segmentToMatch}()")).Value; } if (nextNode == null) From 1a647928e033f4047b832b4446273187defce321 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 5 Dec 2025 16:17:57 -0500 Subject: [PATCH 3/4] Update CheckCloudSupport.csproj --- src/CheckCloudSupport.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CheckCloudSupport.csproj b/src/CheckCloudSupport.csproj index 4b9785c..b19388e 100644 --- a/src/CheckCloudSupport.csproj +++ b/src/CheckCloudSupport.csproj @@ -15,9 +15,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From b44dccb955a40f9dcb3fa83f275c3173bee9b660 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 5 Dec 2025 16:20:39 -0500 Subject: [PATCH 4/4] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 5efd92b..c221fd5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 9.x + dotnet-version: 10.x - name: Restore dependencies run: dotnet restore - name: Build