Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Feature: Add support for Proto3 language #6

Closed
jhugard opened this issue Jan 3, 2016 · 4 comments · Fixed by #13
Closed

Feature: Add support for Proto3 language #6

jhugard opened this issue Jan 3, 2016 · 4 comments · Fixed by #13
Milestone

Comments

@jhugard
Copy link
Collaborator

jhugard commented Jan 3, 2016

Requesting simultaneous support for both proto2 and proto3 language syntax, selected via the new syntax = "[proto2|proto3]"; statement.

https://developers.google.com/protocol-buffers/docs/reference/proto3-spec

As possible incentive, the official C# generator for Proto3 does not (and will not) support generating code for the proto2 language, and thus it is not (and will-not-be) possible to write protobuf tooling and self-describing services in .NET.

Perhaps Froto can be used to fill that need.

@ctaggart
Copy link
Owner

Why is it not possible to write self-describing services in .NET for Protocol Buffers v3? What do you mean by self-describing services? Do you mean code-first with attributes like:
https://github.com/mgravell/protobuf-net#1-first-decorate-your-classes

@jhugard
Copy link
Collaborator Author

jhugard commented Jan 16, 2016

Have in mind to create a service registration protocol which allows a generic service to register it's FileDescriptorProto (or Set) at run-time, so that the service's metadata can be inspected as well as to provide transcoding from/to JSON, without recompiling the server being registered with. That's what I meant by "self-describing services".

The official C# generator from Google will not generate code for proto2, but proto2 is required if one wants to define and process custom options in .NET. So... I am hunting for an alternative.

@ctaggart
Copy link
Owner

I had to read up more about custom options. I have't used them, but they could be useful for altering the code generation. It looks to me like you can put custom options in a proto3 descriptor. Did I miss something?

https://developers.google.com/protocol-buffers/docs/proto#options
https://developers.google.com/protocol-buffers/docs/proto3#options
https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L35-L37

@jhugard
Copy link
Collaborator Author

jhugard commented Jan 16, 2016

Hah. What you missed is that while custom options can be used in proto3, they require proto2 syntax to define (custom options use the extend keyword, which is proto2 only). Further, the Google C# code generator only supports generating proto3 constructs, so while it will recognize custom options, it will not generate code to access them. :P

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants