fix(dotnet): separate codegen for v1alpha and v1beta#186
Merged
Conversation
…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`
ed0359c to
b691f96
Compare
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>
b691f96 to
01eec0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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