planetscale / planetscale/vtprotobuf

Duplicated code generated for GRPC client/server

Open
#101 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.1k
Forks
112
PR merge metrics
No merged PRs in 30d

Description

Hi All,
I'm running the vtproto generator on the proto below, we use both the go + go-grpc generators in addition to vtproto.

However when I run the vtproto generator it duplicates the grpc generated code.

What's the best way to deal with this type of proto to remove the duplicated code?

  1. Split the proto files into two files: messages.proto + grpc.proto?
  2. Ignore the generated gRPC types when running the vtproto generator?

Thanks!
Glenn

Single proto

Attached are the generated files: gen.zip

syntax = "proto3";

package pingpong;
option go_package = "pingpong";

service PingPongService {
  rpc Pong(PingRequest) returns (PongResponse) {}
}

message PingRequest {
  string hello = 1;
}

message PongResponse {
  string world = 1;
}

Split protos

Attached are the split generated files: gen 2.zip

messages.proto

syntax = "proto3";

package pingpong;
option go_package = "gen";

message PingRequest {
  string hello = 1;
}

message PongResponse {
  string world = 1;
}

grpc.proto

syntax = "proto3";

package pingpong;
option go_package = "gen";
import "messages.proto";

service PingPongService {
  rpc Pong(PingRequest) returns (PongResponse) {}
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the generated outputs in the attached gen.zip and gen 2.zip files with the single and split proto examples. Trace how the vtproto generator handles service definitions alongside message types. Done means the intended handling of gRPC-generated code is defined and the duplicate output is eliminated or the supported proto layout is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.