chore(csharp): DO NOT MERGE force templateVersion v2 for a snapshot reference run
DO NOT MERGE
Why
This draft is a reference run to measure which existing C# SDK configurations generate and compile with the v2 templates. Do not merge.
What changed
C# generation selects the v2 templates and writes templateVersion: v2 to the effective generation configuration, including when the input omits the field or sets it to v1.
Testing
The target resolution test covers missing configuration, an omitted template version, explicit v1 and v2, and the version written to disk. Request C# snapshot testing for this draft.
[skip changelog]
Public-safety check
- This change contains no credentials, customer documents, private repository URLs, private filesystem paths, or unredacted private logs.
- Title, body, and commit message contain no customer-derived identifiers, private paths or trackers, or workflow provenance.
- Generated fixtures and review SDK changes are public-safe.
- I reviewed
git diff --check.
Summary by cubic
DO NOT MERGE. Forces every C# target to generate with templateVersion: v2 and dotnetVersion: net8.0, whatever gen.yaml selects, writing both to the effective configuration for a snapshot reference run that measures which existing C# SDK configurations generate and compile with v2. The branch also carries the csharpv2 template and its support work; do not merge.
What changed
- Adds the
csharpv2template, generating SDKs through System.Text.Json source generation and Roslyn generators instead of Newtonsoft.Json reflection, trimming- and NativeAOT-safe on net8.0/net10.0 and netstandard2.0, built as a single assembly. - Templates inherit files from a base template via
template.yaml(csharpv2overlayscsharp;cliaddsgoas an additional search path), and agetFixedConfighook keeps target-fixed values out of saved gen.yaml. csharpv2adds lenient schema validation, unknown-field preservation behind thepreserveUnknownFieldsoption, rejection of missing required and explicit-null non-nullable fields, and undiscriminated-union scoring guarded on all[JsonRequired]members so payloads lacking optional fields no longer skip a variant.- Generated csharpv2 SDKs build with
TreatWarningsAsErrors, keeping only CS0618 and NU1901-NU1904 as warnings so compiler and NuGet warnings fail the build. - Bundles CLI fixes merged into the branch:
--jqhalt/halt_error semantics, env/config output-format validation, and async failure errors no longer falling back to the whole poll response. - C#
additionalPropertiesnow spread at the top level behind aspreadAdditionalPropertiesfix flag, on for new SDKs. - CI runs csharpv2 tests with AOT publish and native usage, and fails when a generated v2 SDK references Newtonsoft.Json.