From f04f5cf93f9c4520c117e3addd93ab60709ab3ab Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 9 Sep 2026 22:38:37 +0200 Subject: [PATCH 1/2] chore: upgrade to corvus.json v5 BREAKING CHANGE: This requires upgrading to Corvus.Json.ExtendedTypes 5.0.0 or greater --- README.md | 6 +++--- .../CodeGeneration/SchemaGenerator.cs | 10 ++++++---- .../OpenAPI.WebApiGenerator.csproj | 4 ++-- .../CompatibilitySuppressions.xml | 16 ++++++++++++++++ tests/Example.OpenApi20/Example.OpenApi20.csproj | 2 +- tests/Example.OpenApi30/Example.OpenApi30.csproj | 2 +- tests/Example.OpenApi31/Example.OpenApi31.csproj | 2 +- tests/Example.OpenApi32/Example.OpenApi32.csproj | 2 +- .../OpenAPI.WebApiGenerator.Tests.csproj | 2 +- .../OpenAPI.WebApiGenerator.UnitTests.csproj | 2 +- 10 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 tests/Example.OpenApi20/CompatibilitySuppressions.xml diff --git a/README.md b/README.md index 16e0ef5..86b330f 100644 --- a/README.md +++ b/README.md @@ -51,11 +51,11 @@ Supported data formats are: 3. Add references to [Corvus.Json.ExtendedTypes](https://github.com/corvus-dotnet/Corvus.JsonSchema?tab=readme-ov-file#corvusjsonextendedtypes) and [ParameterStyleParsers.OpenAPI](https://github.com/Fresa/OpenAPI.ParameterStyleParsers). ``` - - + + ``` -* Corvus.Json.ExtendedTypes >= 4.0.0 +* Corvus.Json.ExtendedTypes >= 5.0.0 * ParameterStyleParsers.OpenAPI >= 1.4.0 4. Compile the project. diff --git a/src/OpenAPI.WebApiGenerator/CodeGeneration/SchemaGenerator.cs b/src/OpenAPI.WebApiGenerator/CodeGeneration/SchemaGenerator.cs index f5ab7aa..3bca5a4 100644 --- a/src/OpenAPI.WebApiGenerator/CodeGeneration/SchemaGenerator.cs +++ b/src/OpenAPI.WebApiGenerator/CodeGeneration/SchemaGenerator.cs @@ -159,14 +159,16 @@ private List GenerateCode(SourceGeneratorHelpers.TypesToGenerat var generatedCode = typeBuilder.GenerateCodeUsing( languageProvider, - context.CancellationToken, - typeDeclarationsToGenerate); + typeDeclarationsToGenerate, + context.CancellationToken); foreach (var codeFile in generatedCode) { context.CancellationToken.ThrowIfCancellationRequested(); - - var filePath = namespaceToPathConversion[codeFile.TypeDeclaration.DotnetNamespace()]; + + var filePath = namespaceToPathConversion[ + codeFile.TypeDeclaration?.DotnetNamespace() ?? throw new InvalidOperationException( + $"Code file {codeFile.FileName} does not have a namespace. This is an internal implementation error.")]; var fileName = Path.Combine(filePath, codeFile.FileName); // Deduplicate nested schemas that might already have been generated diff --git a/src/OpenAPI.WebApiGenerator/OpenAPI.WebApiGenerator.csproj b/src/OpenAPI.WebApiGenerator/OpenAPI.WebApiGenerator.csproj index df7c5f1..2dfd5f7 100644 --- a/src/OpenAPI.WebApiGenerator/OpenAPI.WebApiGenerator.csproj +++ b/src/OpenAPI.WebApiGenerator/OpenAPI.WebApiGenerator.csproj @@ -53,8 +53,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Example.OpenApi20/CompatibilitySuppressions.xml b/tests/Example.OpenApi20/CompatibilitySuppressions.xml new file mode 100644 index 0000000..6d4c7a6 --- /dev/null +++ b/tests/Example.OpenApi20/CompatibilitySuppressions.xml @@ -0,0 +1,16 @@ + + + + + CP0002 + M:Example.OpenApi20.Parameters.FooId.op_Implicit(Example.OpenApi20.Parameters.FooId)~System.Int64 + LastMajorVersionBinary/Example.OpenApi20.dll + obj/net9.0/Example.OpenApi20.dll + + + CP0002 + M:Example.OpenApi20.Parameters.FooId.op_Implicit(System.Int64)~Example.OpenApi20.Parameters.FooId + LastMajorVersionBinary/Example.OpenApi20.dll + obj/net9.0/Example.OpenApi20.dll + + \ No newline at end of file diff --git a/tests/Example.OpenApi20/Example.OpenApi20.csproj b/tests/Example.OpenApi20/Example.OpenApi20.csproj index fb54a8e..8011bc2 100644 --- a/tests/Example.OpenApi20/Example.OpenApi20.csproj +++ b/tests/Example.OpenApi20/Example.OpenApi20.csproj @@ -14,7 +14,7 @@ - + diff --git a/tests/Example.OpenApi30/Example.OpenApi30.csproj b/tests/Example.OpenApi30/Example.OpenApi30.csproj index 25e57fe..028e33f 100644 --- a/tests/Example.OpenApi30/Example.OpenApi30.csproj +++ b/tests/Example.OpenApi30/Example.OpenApi30.csproj @@ -14,7 +14,7 @@ - + diff --git a/tests/Example.OpenApi31/Example.OpenApi31.csproj b/tests/Example.OpenApi31/Example.OpenApi31.csproj index d7cff7f..6e130fc 100644 --- a/tests/Example.OpenApi31/Example.OpenApi31.csproj +++ b/tests/Example.OpenApi31/Example.OpenApi31.csproj @@ -14,7 +14,7 @@ - + diff --git a/tests/Example.OpenApi32/Example.OpenApi32.csproj b/tests/Example.OpenApi32/Example.OpenApi32.csproj index 9f7c92f..ac514fd 100644 --- a/tests/Example.OpenApi32/Example.OpenApi32.csproj +++ b/tests/Example.OpenApi32/Example.OpenApi32.csproj @@ -13,7 +13,7 @@ - + diff --git a/tests/OpenAPI.WebApiGenerator.Tests/OpenAPI.WebApiGenerator.Tests.csproj b/tests/OpenAPI.WebApiGenerator.Tests/OpenAPI.WebApiGenerator.Tests.csproj index 7643ccf..4f1a955 100644 --- a/tests/OpenAPI.WebApiGenerator.Tests/OpenAPI.WebApiGenerator.Tests.csproj +++ b/tests/OpenAPI.WebApiGenerator.Tests/OpenAPI.WebApiGenerator.Tests.csproj @@ -8,7 +8,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/OpenAPI.WebApiGenerator.UnitTests/OpenAPI.WebApiGenerator.UnitTests.csproj b/tests/OpenAPI.WebApiGenerator.UnitTests/OpenAPI.WebApiGenerator.UnitTests.csproj index be6fde6..c7be35e 100644 --- a/tests/OpenAPI.WebApiGenerator.UnitTests/OpenAPI.WebApiGenerator.UnitTests.csproj +++ b/tests/OpenAPI.WebApiGenerator.UnitTests/OpenAPI.WebApiGenerator.UnitTests.csproj @@ -8,7 +8,7 @@ - + From b639419bfe34b2d9df17a508b0cb7c5f93366e36 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 9 Sep 2026 22:41:29 +0200 Subject: [PATCH 2/2] ci: bump to latest action versions --- .github/workflows/cd.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3bd5bd4..4815fad 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,10 +22,10 @@ jobs: matrix: os: [ubuntu-latest] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Setup .NET id: dotnet - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: dotnet-version: ${{ env.dotnet_version }} - name: Build @@ -49,5 +49,6 @@ jobs: project_path: ${{ needs.test.outputs.project_path }} project_name: ${{ needs.test.outputs.project_name }} dotnet_version: ${{ needs.test.outputs.dotnet_version }} + include_github_release_notes: true secrets: nuget_api_key: ${{ secrets.NUGET_API_KEY }}