fix(dotnet): separate codegen for v1alpha and v1beta #186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The C# protobuf code generator outputs flat
.csfiles where filename = proto filename. When bothv1alpha/query.protoandv1beta/query.protoexist, they both generateQuery.cs, causing a collision and build failure.Solution
buf.gen.yamlfiles (v2 format) for each versiongen/dotnet/v1alpha/andgen/dotnet/v1beta/.csprojincludes both with distinct namespaces (Utxorpc.V1Alpha.*,Utxorpc.V1Beta.*)Why This Approach
This matches industry standards (Google Cloud APIs, Microsoft gRPC guidelines, AIP-185). The C# generator has no
paths=source_relativeequivalent like Go/Rust, making separate output directories the only viable solution.Package Strategy
Ideally, we would publish separate NuGet packages for each API version (
Utxorpc.Spec.V1Alpha,Utxorpc.Spec.V1Beta). However, since we are not planning further updates to the v1alpha spec, we are publishing a single package that includes both versions for now. This allows:This approach can be revisited if version isolation becomes necessary in the future.
Changes
buf.gen.yamlto exclude C# (generated separately)buf.gen.dotnet.v1alpha.yamlandbuf.gen.dotnet.v1beta.yaml(v2 format).csprojto .NET 10 and latest packages (Google.Protobuf 3.33.4, Grpc 2.76.0).gitignoreto exclude generated C# filesTest plan
buf generatesucceeds for both v1alpha and v1betadotnet buildsucceeds with both versions included🤖 Generated with Claude Code