Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 25, 2025

  • Updated DependencyInstaller.InstallNSwag() to use dotnet tool install --global NSwag.ConsoleCore instead of npm
  • Updated NSwagCSharpCodeGenerator to invoke the NSwag CLI command instead of library
  • Created own CSharpClassStyle enum in Core to avoid library dependency in interface
  • Updated CLI factory NSwagCodeGeneratorFactory to use the new generator pattern
  • Updated VSIX CodeGeneratorFactory to pass required dependencies
  • Updated VSIX option pages to use own CSharpClassStyle enum
  • Updated Core unit tests to use new generator pattern
  • Fixed VSIX build failure - Updated NSwagCSharpCodeGeneratorTests.cs to use the new constructor signature
  • Fixed Unit Test failure - Updated DependencyInstallerTests.InstallNSwag test to verify dotnet tool installation instead of npm
  • Fixed Integration Test failures - Updated NSwag fixtures to use real ProcessLauncher and DependencyInstaller implementations instead of mocks
Original prompt

Update the support for NSwag to use the same approach as Refitter and Kiota. Instead of referencing the NSwag library, download and
install the NSwag CLI tool from nuget.org (dotnet tool install --global NSwag.ConsoleCore)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link

coderabbitai bot commented Nov 25, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
@christianhelle
Copy link
Owner

@copilot you seemed to have hit a rate limit. continue where you left

Copilot AI and others added 2 commits November 25, 2025 15:37
Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 25, 2025

@copilot you seemed to have hit a rate limit. continue where you left

Continuing the work from where I left off. I've completed the NSwag CLI migration in commit 595d3ae. Key changes:

  • Updated DependencyInstaller.InstallNSwag() to use dotnet tool install --global NSwag.ConsoleCore --version 14.4.0
  • Rewrote NSwagCSharpCodeGenerator to invoke nswag openapi2csclient CLI command
  • Created CSharpClassStyle enum in Core to avoid NSwag library dependency in interfaces
  • Updated all test fixtures, VSIX option pages, and factories to use the new pattern

Build succeeds and CLI generates code correctly via rapicgen csharp nswag.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • azuresdkartifacts.blob.core.windows.net
    • Triggering command: /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/apiclientcodegen/apiclientcodegen/test/GeneratedCode/AutoRest-V3/Net481/Net481.csproj --packages /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)
    • Triggering command: /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/apiclientcodegen/apiclientcodegen/test/GeneratedCode/AutoRest-V3/Net462/Net462.csproj --packages /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)
    • Triggering command: /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/apiclientcodegen/apiclientcodegen/test/GeneratedCode/AutoRest-V3/NetStandard20/NetStandard20.csproj --packages /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)
  • petstore.swagger.io
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.deps.json /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/testhost.dll --port 38263 --endpoint 127.0.0.1:038263 --role client --parentprocessid 4800 --telemetryoptedin false (dns block)
  • westeurope-5.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen csharp nswag Swagger.json GeneratedCode /tmp/nswag-output.cs (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update NSwag support to align with Refitter and Kiota Update NSwag support to align with Refitter and Kiota Nov 25, 2025
Copilot finished work on behalf of christianhelle November 25, 2025 15:54
@christianhelle
Copy link
Owner

@copilot the VSIX and Unit Test builds are failing

…orTests and DependencyInstallerTests

Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot the VSIX and Unit Test builds are failing

Fixed in commit c93f1a1. The issues were:

  1. VSIX build: NSwagCSharpCodeGeneratorTests.cs was using the old constructor signature - updated to use the new pattern with IProcessLauncher, IDependencyInstaller, and INSwagOptions
  2. Unit Test: DependencyInstallerTests.InstallNSwag_Invokes_Npm was expecting npm installation but the code now uses dotnet tool install - updated test to verify the new dotnet tool installation behavior

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • azuresdkartifacts.blob.core.windows.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet build /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/8beed8304ccb4063b6f26a62b812c183/Project.csproj (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet build /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/98b1cec36f9549129186d04aff5bb7ce/Project.csproj (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet build /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/9a8b2186afeb46b488a39e593e86f0ab/Project.csproj (dns block)
  • https://api.github.com/repos/microsoft/kiota/releases
    • Triggering command: /home/REDACTED/.dotnet/tools/kiota kiota generate -l CSharp -d /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/Swagger7570c869258c48b3b4752372cd27af90.yaml -o /tmp/0f631e21-f500-4153-a9d3-9ce64667c71d -n GeneratedCode --type-access-modifier Public (http block)
    • Triggering command: /home/REDACTED/.dotnet/tools/kiota kiota generate -l CSharp -d /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/Swagger1f25f727c89843bcaefb451cfe05bc5e.json -o /tmp/77803af8-8c0f-4b13-9d7b-7b75d680cbfe -n GeneratedCode --type-access-modifier Public (http block)
    • Triggering command: /home/REDACTED/.dotnet/tools/kiota kiota update -o /tmp/77803af8-8c0f-4b13-9d7b-7b75d680cbfe (http block)
  • petstore.swagger.io
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.deps.json /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/testhost.dll --port 39243 --endpoint 127.0.0.1:039243 --role client --parentprocessid 4418 --telemetryoptedin false (dns block)
    • Triggering command: /home/REDACTED/.dotnet/tools/nswag nswag run /tmp/bbd22d03-b3a1-4bd6-8c7d-f176920aa77d/Petstore.nswag (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/ApiClientCodeGen.Core.IntegrationTests.runtimeconfig.json --depsfile /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/ApiClientCodeGen.Core.IntegrationTests.deps.json /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.IntegrationTests/bin/Debug/net8.0/testhost.dll --port 39043 --endpoint 127.0.0.1:039043 --role client --parentprocessid 4394 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of christianhelle November 26, 2025 08:35
@christianhelle
Copy link
Owner

@copilot there are still 8 failing tests in ApiClientCodeGen.Core.IntegrationTests

Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot there are still 8 failing tests in ApiClientCodeGen.Core.IntegrationTests

Fixed in commit b9b83fa. The integration test fixtures (NSwagCodeGeneratorFixture) were using mock IProcessLauncher and IDependencyInstaller instead of real implementations. Updated all 4 fixtures in /Fixtures/, /Fixtures/Yaml/, /Fixtures/OpenApi3/, and /Fixtures/OpenApi3/Yaml/ to use real ProcessLauncher and DependencyInstaller implementations, matching the pattern used by KiotaCodeGeneratorFixture.

Copilot finished work on behalf of christianhelle November 26, 2025 09:54
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
3.4% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants