fix(stp): ship net10.0 abstractions and document target frameworks#76
Conversation
|
@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 |
| using Microsoft.Extensions.DependencyInjection; | ||
| using Microsoft.OpenApi.Models; | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization.Metadata; |
There was a problem hiding this comment.
| 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.
There was a problem hiding this comment.
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>
31d75d2 to
0b2faeb
Compare
Maintenance review of target framework support for
Egil.StronglyTypedPrimitives: eachnet9.0/net8.0/netstandard2.0target 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 shippedlib/net10.0. net10.0 consumers therefore fell back to thelib/net9.0assembly, which is compiled against the incompatible Microsoft.OpenApi v1 API.Changes
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.lib/net10.0folder is populated.netstandard2.0is required for the Roslyn source generator; the Abstractions targetnet10.0/net9.0/net8.0/netstandard2.0for consumer compatibility and per-runtime OpenAPI support.net9.0;net10.0so 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.csconvention; the v2 file asserts theJsonSchemaTypeenum and accounts for the now-nullableItems/Propertiesmembers. Test files keep the*Test.csnaming so the repo's test-specific analyzer rules (for example CA1707) continue to apply.CI continues to install only the
9.xand10.xSDK 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).