quicktype icon indicating copy to clipboard operation
quicktype copied to clipboard

Generation of Protobuf .proto Files

Open mikes-blend opened this issue 6 years ago • 5 comments

There are myriad tools in the ecosystem to generate types for all the various languages supported by quicktype, from proto files, but very little capable of going the other way. I feel this is a gap that quicktype is uniquely positioned to help solve.

Use case is this:

  • An API specification already exists in one of quicktype's existing source formats. (TypeScript, JSON Schema, etc.)
  • Developer wants to also provide Protobuf serialization or GRPC support for that API specification.
  • Quicktype can generate the .proto definition file for the types in the API spec
  • Other tools (protoc, gogoproto, protobuf.js), can generate a full serialization client from the .proto file

Challenges:

  • How to ensure the Field Numbers remain consistent through generation of multiple versions of the .proto file.

Reference:

Protobuf 3: Proto File Specification: https://developers.google.com/protocol-buffers/docs/proto3

mikes-blend avatar Jul 20 '19 00:07 mikes-blend

Seconded. I would use this to check "what would protobuf look like" and use that as a starting point.

vivainio avatar Jan 29 '20 08:01 vivainio

Just chiming in that this would really help cut down the time spent converting existing REST API's to gRPC services. Proto3 would probably be the ideal target version as v2 isn't used as much anymore.

Pilfer avatar May 08 '20 21:05 Pilfer

Hopes to add support for the conversion of pb files

axiaoxin avatar Nov 27 '22 07:11 axiaoxin

news?

HudsonAfonso avatar Aug 20 '24 18:08 HudsonAfonso

@HudsonAfonso I ended up using something similar to https://json-to-proto.github.io/, which worked well enough.

Pilfer avatar Aug 22 '24 17:08 Pilfer