Skip to content

fix(stp): ship net10.0 abstractions and document target frameworks#76

Merged
egil merged 1 commit into
mainfrom
copilot/maintenance-review-target-framework-support-yet-again
Jun 12, 2026
Merged

fix(stp): ship net10.0 abstractions and document target frameworks#76
egil merged 1 commit into
mainfrom
copilot/maintenance-review-target-framework-support-yet-again

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Maintenance review of target framework support for Egil.StronglyTypedPrimitives: each net9.0/net8.0/netstandard2.0 target needs an explicit decision, and CI should install only the SDKs the retained targets require.

While reviewing, I found a packaging defect: the Abstractions library multi-targets net10.0 (with a dedicated net10.0 OpenAPI schema transformer), but the package never shipped lib/net10.0. net10.0 consumers therefore fell back to the lib/net9.0 assembly, which is compiled against the incompatible Microsoft.OpenApi v1 API.

Changes

  • Ship lib/net10.0 — added the missing pack item in the generator csproj. A glob that matches nothing is silently dropped, so the absent net10.0 build went unnoticed.
  • Build net10.0 in CI — the create-nuget job now builds the net10.0 Abstractions before packing so the new lib/net10.0 folder is populated.
  • Documented every target framework decision — added csproj comments explaining why each target is retained: netstandard2.0 is required for the Roslyn source generator; the Abstractions target net10.0/net9.0/net8.0/netstandard2.0 for consumer compatibility and per-runtime OpenAPI support.
  • Multi-targeted OpenAPI v2 test pass — the integration test project now multi-targets net9.0;net10.0 so the schema transformer is exercised against both the Microsoft.OpenApi v1 API (net9.0) and the v2 API (net10.0). The transformer test is split per target framework (StronglyTypedSchemaTransformerV1Test.cs / StronglyTypedSchemaTransformerV2Test.cs) to mirror the production .net9.cs/.net10.cs convention; the v2 file asserts the JsonSchemaType enum and accounts for the now-nullable Items/Properties members. Test files keep the *Test.cs naming so the repo's test-specific analyzer rules (for example CA1707) continue to apply.

CI continues to install only the 9.x and 10.x SDK bands required by the retained targets. Validated with build, pack, package validation, and the full test suite (127 unit + 43 integration on net9.0 + 43 integration on net10.0).

Copilot AI changed the title [WIP] Review target framework support for maintenance fix(stp): ship net10.0 abstractions and document target frameworks Jun 12, 2026
Copilot AI requested a review from egil June 12, 2026 09:40
@egil egil marked this pull request as ready for review June 12, 2026 09:41
@egil

egil commented Jun 12, 2026

Copy link
Copy Markdown
Owner

@copilot lets add a multi-targeted test pass against the Microsoft.OpenApi v2 API is a reasonable follow-up.

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot lets add a multi-targeted test pass against the Microsoft.OpenApi v2 API is a reasonable follow-up.

Done in 26ed985. The integration test project now multi-targets net9.0;net10.0, so the schema transformer runs against the Microsoft.OpenApi v1 API (net9.0) and the v2 API (net10.0). The transformer test is split per TFM (StronglyTypedSchemaTransformerV1Test.cs / V2Test.cs) to mirror the production .net9.cs/.net10.cs split; the v2 file asserts JsonSchemaType and handles the now-nullable Items/Properties. Both passes are green (43 tests each).

Copilot finished work on behalf of egil June 12, 2026 09:51
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using System.Text.Json;
using System.Text.Json.Serialization.Metadata;

@egil egil Jun 12, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
using Examples;
using Microsoft.AspNetCore.OpenApi;
using Microsoft.Extensions.DependencyInjection;
#if NET9_0
using Microsoft.OpenApi.Models;
#elseif NET10_0
using Microsoft.OpenApi;
#endif
using System.Text.Json;
using System.Text.Json.Serialization.Metadata;

@copilot There's no need to have two different test classes. I think we can just import different using statements per.NET target and keep a single test class since it looks like all the tests are the same in both this test class and the v2 test class.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Done in 31d75d2. Merged into a single StronglyTypedSchemaTransformerTest with conditional usings. The bodies weren't fully identical (v1 uses string schema types, v2 uses the JsonSchemaType enum, and Properties/Items are nullable in v2), so the class defines per-TFM type constants and a shared AssertNoProperties helper to keep all test bodies identical. Both TFMs pass (43/43).

Review the target framework support of the Egil.StronglyTypedPrimitives
package and make each retained target an explicit, documented decision.

The Abstractions runtime library already multi-targeted net10.0 and
shipped a net10.0-specific OpenAPI schema transformer, but the package
never included a lib/net10.0 folder. As a result net10.0 consumers fell
back to the net9.0 assembly, which is built against the incompatible
Microsoft.OpenApi v1 API. Pack the net10.0 build into lib/net10.0 and
build it in CI so the active target is shipped correctly.

Document the rationale for every target framework: netstandard2.0 is
required for the Roslyn source generator; the Abstractions target
net10.0/net9.0/net8.0/netstandard2.0 for consumer compatibility and
per-runtime OpenAPI support. The integration tests now run against both
net9.0 and net10.0 to validate the schema transformer across both
Microsoft.OpenApi v1 and v2.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@egil egil force-pushed the copilot/maintenance-review-target-framework-support-yet-again branch from 31d75d2 to 0b2faeb Compare June 12, 2026 10:29
@egil egil merged commit e7f1768 into main Jun 12, 2026
10 checks passed
@egil egil deleted the copilot/maintenance-review-target-framework-support-yet-again branch June 12, 2026 11:13
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