Skip to content

Commit ed88a1b

Browse files
Validate OpenAPI documents create valid C# clients (#3686)
* Add code generation integration tests Initial infrastructure for integration tests that validate OpenAPI documents can generate valid C# clients using Kiota and NSwag. * Refactor client generator code Move to its own class to slim down the test. * Extend Pet Store test cases Add test cases for Swagger 2.0 and YAML, where relevant. * Generate clients from snapshots Generate client code from snapshot files and running applications instead of Pet Store. * Enable nullable Enable nullable annotations in the generated client code. * Deduplicate tests Just validate the snapshots, not the applications as well (which are used to generate the snapshots). * Refactor switch statement Refactor to make the lines less long.
1 parent 0e042af commit ed88a1b

7 files changed

Lines changed: 475 additions & 0 deletions

File tree

.config/dotnet-tools.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
"meziantou.validate-nuget-package"
2323
],
2424
"rollForward": false
25+
},
26+
"microsoft.openapi.kiota": {
27+
"version": "1.29.0",
28+
"commands": [
29+
"kiota"
30+
],
31+
"rollForward": false
2532
}
2633
}
2734
}

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ jobs:
8888
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1
8989
id: setup-dotnet
9090

91+
- name: Install .NET tools
92+
shell: pwsh
93+
run: |
94+
dotnet tool restore
95+
9196
- name: Build, Package and Test
9297
id: build
9398
shell: pwsh

Directory.Packages.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@
1313
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
1414
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
1515
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.22" />
16+
<PackageVersion Include="Microsoft.Build" Version="18.0.2" />
1617
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="4.14.0" />
18+
<PackageVersion Include="Microsoft.Kiota.Bundle" Version="1.21.0" />
1719
<PackageVersion Include="Microsoft.OpenApi" Version="2.3.9" />
1820
<PackageVersion Include="Microsoft.OpenApi.YamlReader" Version="2.3.9" />
1921
<PackageVersion Include="Microsoft.Playwright" Version="1.56.0" />
2022
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
23+
<PackageVersion Include="MSBuild.ProjectCreation" Version="17.0.1" />
2124
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
2225
<PackageVersion Include="NSubstitute" Version="5.3.0" />
26+
<PackageVersion Include="NSwag.CodeGeneration.CSharp" Version="14.6.3" />
2327
<PackageVersion Include="NSwag.MSBuild" Version="14.6.3" />
2428
<PackageVersion Include="ReportGenerator" Version="5.5.0" />
2529
<PackageVersion Include="Verify.XunitV3" Version="31.7.2" />

0 commit comments

Comments
 (0)