Skip to content

Add ability to get FileDescriptorSet serialization in C# #5441

Closed
@mcon-gr

Description

What language does this apply to?
This issue relates to the C# Google.Protobuf package.

Describe the problem you are trying to solve.
Currently there is no way to obtain a ByteString from generated code, which represents either a message/proto-file with its dependencies which can be used with protoc. The appropriate data structure for this is FileDescriptorSet.

In particular I'd like to be able to generate protobuf code for another language given the generated C# protobuf code. We can already get an IList<FileDescriptor> of dependencies through the Dependencies property on FileDescriptor, all that needs to be done is bundling that with the instance of the FileDescrpitor and putting that into a FileDescriptorSet data structure and serializing.

Describe the solution you'd like
I'd like to add facility to get the serialized representation of FileDescriptorSet, containing all dependencies from either a FileDescriptor or a MessageDescriptor. This is code I'd be happy to write/test myself.

Describe alternatives you've considered
Ultimately the 2 formats for specifying protobuf messages are:

  • .proto files
  • FileDescriptorSets
    Given the necessary information is already stored in generated code to obtain the FileDescriptorSet, and this mechanism allows for easy bundling of dependencies, that seemed like the best way forward.

Additional context
The reason I'm looking to generate code for other languages, given the generated code for one (in this case C#), is to facilitate adding Protobuf support to the Pact contract testing framework. I can provide additional context if required.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions