Skip to content

fix(dotnet): separate codegen for v1alpha and v1beta#186

Merged
Mercurial merged 10 commits intomainfrom
fix/dotnet-codegen
Feb 2, 2026
Merged

fix(dotnet): separate codegen for v1alpha and v1beta#186
Mercurial merged 10 commits intomainfrom
fix/dotnet-codegen

Conversation

@Mercurial
Copy link
Contributor

Problem

The C# protobuf code generator outputs flat .cs files where filename = proto filename. When both v1alpha/query.proto and v1beta/query.proto exist, they both generate Query.cs, causing a collision and build failure.

Solution

  • Separate buf.gen.yaml files (v2 format) for each version
  • Generate to subdirectories: gen/dotnet/v1alpha/ and gen/dotnet/v1beta/
  • Single .csproj includes 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_relative equivalent 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:

  • Existing v1alpha consumers to continue using the legacy API
  • New consumers to adopt v1beta
  • A simpler migration path without managing multiple package dependencies

This approach can be revisited if version isolation becomes necessary in the future.

Changes

  • Updated buf.gen.yaml to exclude C# (generated separately)
  • Added buf.gen.dotnet.v1alpha.yaml and buf.gen.dotnet.v1beta.yaml (v2 format)
  • Updated .csproj to .NET 10 and latest packages (Google.Protobuf 3.33.4, Grpc 2.76.0)
  • Updated CI workflow to run both dotnet codegen steps
  • Updated .gitignore to exclude generated C# files

Test plan

  • Local buf generate succeeds for both v1alpha and v1beta
  • dotnet build succeeds with both versions included
  • CI workflow passes

🤖 Generated with Claude Code

scarmuega and others added 8 commits December 22, 2025 11:38
…hash` (#180)

Other fields containing hashes have `_hash` prefix. This change renames
the field to follow the suit.
Since currently both of the variants of `quantity` can store negative
values, there is no point of having them both if they serve the same
purpose.
* feat(cardano): Mark optional fields in TxOutput hierarchy optional in proto definition
* feat(cardano): Add Plutus V4 fields to proto definition
* chore(cardano): Add comments to `BigInt` and `TreasuryWithdrawalsAction.withdrawals`
wolf31o2 and others added 2 commits January 26, 2026 18:55
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
The C# protobuf generator outputs flat .cs files where filename = proto
filename. When both v1alpha and v1beta have the same proto files, they
collide (e.g., both generate Query.cs).

This fix:
- Adds separate buf.gen.dotnet.v1alpha.yaml and v1beta.yaml (v2 format)
- Generates to subdirectories: gen/dotnet/v1alpha/ and v1beta/
- Updates .csproj to .NET 10 and latest packages
- Updates CI workflow to run both dotnet codegen steps
- Updates .gitignore to exclude generated C# files

This matches industry standards (Google Cloud APIs, Microsoft gRPC, AIP-185).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Mercurial Mercurial changed the base branch from main to chore/initialize-v1beta January 26, 2026 10:58
@Mercurial Mercurial marked this pull request as draft January 26, 2026 10:58
@Mercurial Mercurial requested a review from scarmuega January 26, 2026 10:58
@Mercurial Mercurial marked this pull request as ready for review February 2, 2026 15:12
Base automatically changed from chore/initialize-v1beta to main February 2, 2026 15:13
@Mercurial Mercurial merged commit a530161 into main Feb 2, 2026
7 checks passed
@Mercurial Mercurial deleted the fix/dotnet-codegen branch February 2, 2026 15: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.

4 participants