Skip to content

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

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
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.

3 participants