Skip to content

Target .NET 10 and .NET 11, drop .NET 8/9, use OpenApiSchema.Examples - #51

Merged
temonk merged 2 commits into
mainfrom
feature/dotnet11
Nov 11, 2026
Merged

temonk merged 2 commits into
mainfrom
feature/dotnet11

Conversation

@temonk

@temonk temonk commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves the library to net10.0 + net11.0 and drops net8.0 / net9.0. Packages that ship separate builds per .NET version now get framework-specific versions; everything else uses the latest version without a framework condition.

Target frameworks

  • Directory.Build.props: DefaultTargetFrameworks changed to net10.0;net11.0.
  • AltaSoft.DomainPrimitives.OpenApiExtensions: now multi-targets net10.0;net11.0 (was net10.0 only).
  • All test projects multi-target net10.0;net11.0, so the suite runs on both runtimes.
  • Examples (DomainPrimitivesDemo, AltaSoft.DomainPrimitives.Demo) target net10.0;net11.0.
  • CI workflows install the 11.0.x and 10.0.x SDKs.

Package versions (Directory.Packages.props)

Package net10.0 net11.0
Microsoft.AspNetCore.OpenApi 10.0.* 11.0.*
Microsoft.OpenApi 2.* 3.*
Swashbuckle.AspNetCore.SwaggerGen 10.3.* 11.0.*
  • Swashbuckle 11 requires Microsoft.OpenApi 3.x even on net10.0, while Microsoft.AspNetCore.OpenApi 10.x requires 2.x. So net10.0 stays on Swashbuckle 10.3 / OpenApi 2.x.
  • Packages without separate .NET 10/11 builds are updated without a framework condition: Microsoft.NET.Test.Sdk 18.11.1, xunit.runner.visualstudio 4.0.1, coverlet.collector 10.1.0. Microsoft.CodeAnalysis.* is already on the latest version (5.9.0).

OpenAPI: Example → Examples

OpenApiSchema.Example is [Obsolete("Use Examples instead.")] in Microsoft.OpenApi 2.13+ and 3.x.

  • The generator now emits the <example> XML doc value as Examples = [JsonValue.Create(...)] in OpenApiHelper.g.cs.
  • OpenApiOptionsExt.ApplyDomainPrimitiveSchemas copies Examples instead of Example.
  • AltaSoft.DomainPrimitives.SwaggerExtensions now references Microsoft.OpenApi directly. On net10.0, Swashbuckle 10.3 alone only requires OpenApi 2.7.5, whose OpenAPI 3.0 writer ignores Examples. The direct reference raises the floor to 2.13+, which falls back to Examples[0] for OpenAPI 3.0 documents.

Tests

  • New generator snapshot test StringValue_WithXmlExampleStringLengthAndPattern covers <example> for string and numeric primitives (no test previously covered this path).
  • No existing snapshots changed.
  • dotnet build: 0 warnings, 0 errors.
  • dotnet test: all passing on both net10.0 and net11.0 (UnitTests 88, XmlDataTypes.Tests 103, Generator.Tests 48).

Docs

  • README: .NET 10+ badge and prerequisites, new "What's New" entry for .NET 11 support and the Examples change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The Microsoft.OpenApi major-version split needs runtime verification of OpenAPI 3.0 Examples fallback and transformer behavior against both resolved package sets, beyond the new compilation and schema-snapshot tests.

No open issues 🎉

What changed in this PR

Updates AltaSoft.DomainPrimitives to target .NET 10 and .NET 11, drops .NET 8/9 support, and migrates generated OpenAPI schema examples from Example to Examples.

Changes:

  • Updates framework targets, framework-specific dependencies, CI SDKs, and the library version to 9.0.0.
  • Uses OpenApiSchema.Examples in generated schemas and schema mappings.
  • Adds snapshot coverage for string and numeric XML examples and documents the new requirements.
File Description
tests/​AltaSoft.DomainPrimitives.XmlDataTypes.Tests/​AltaSoft.DomainPrimitives.XmlDataTypes.Tests.csproj Runs XML datatype tests on both target frameworks.
tests/​AltaSoft.DomainPrimitives.UnitTests/​AltaSoft.DomainPrimitives.UnitTests.csproj Runs behavioral tests on both target frameworks.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​Snapshots/​DomainPrimitiveGeneratorTest.StringValue_WithXmlExampleStringLengthAndPattern#PositiveAmountTypeConverter.g.verified.cs Adds the numeric type-converter snapshot.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​Snapshots/​DomainPrimitiveGeneratorTest.StringValue_WithXmlExampleStringLengthAndPattern#PositiveAmountJsonConverter.g.verified.cs Adds the numeric JSON-converter snapshot.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​Snapshots/​DomainPrimitiveGeneratorTest.StringValue_WithXmlExampleStringLengthAndPattern#PositiveAmount.g.verified.cs Adds the generated numeric primitive snapshot.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​Snapshots/​DomainPrimitiveGeneratorTest.StringValue_WithXmlExampleStringLengthAndPattern#OpenApiHelper.g.verified.cs Captures schema examples and string constraints.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​Snapshots/​DomainPrimitiveGeneratorTest.StringValue_WithXmlExampleStringLengthAndPattern#CountryCodeTypeConverter.g.verified.cs Adds the string type-converter snapshot.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​Snapshots/​DomainPrimitiveGeneratorTest.StringValue_WithXmlExampleStringLengthAndPattern#CountryCodeJsonConverter.g.verified.cs Adds the string JSON-converter snapshot.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​Snapshots/​DomainPrimitiveGeneratorTest.StringValue_WithXmlExampleStringLengthAndPattern#CountryCode.g.verified.cs Adds the generated string primitive snapshot.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​DomainPrimitiveGeneratorTest.cs Adds XML example coverage for string and numeric primitives.
tests/​AltaSoft.DomainPrimitives.Generator.Tests/​AltaSoft.DomainPrimitives.Generator.Tests.csproj Runs generator tests on both target frameworks.
src/​AltaSoft.DomainPrimitives.OpenApiExtensions/​OpenApiOptionsExt.cs Copies schema Examples instead of Example.
src/​AltaSoft.DomainPrimitives.Generator/​Helpers/​MethodGeneratorHelper.cs Emits XML examples into the Examples collection.
README.md Documents supported frameworks and OpenAPI changes.
Examples/​DomainPrimitivesDemo/​DomainPrimitivesDemo.csproj Updates framework targets and OpenAPI package versions.
Examples/​AltaSoft.DomainPrimitives.Demo/​AltaSoft.DomainPrimitives.Demo.csproj Multi-targets the demo and aligns integration dependencies.
Directory.Packages.props Selects framework-specific dependencies and updates test tooling.
Directory.Build.props Sets .NET 10/11 defaults and version 9.0.0.
.github/​workflows/​publish_nuget.yml Installs .NET 10/11 SDKs for publishing.
.github/​workflows/​dotnet.yml Installs .NET 10/11 SDKs for CI.
.github/​workflows/​build_nuget_dont_publish.yml Installs .NET 10/11 SDKs for package builds.

Review effort: Balanced

@temonk
temonk merged commit c05a26b into main Nov 11, 2026
1 check passed
@temonk
temonk deleted the feature/dotnet11 branch November 11, 2026 07:59
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