We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basically the generated code is using the illegal keyword type in place of a variable representing the type of a Rust enum field.
type
Rust compiler error in generated proto file:
expected identifier, found keyword `type` expected identifier, found keyword rpc_proto.rs(2094, 15): expected identifier, found keyword pub const type: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, ::protobuf::types::ProtobufTypeString> = ::protobuf::ext::ExtFieldOptional
Full line: (pub const type: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, ::protobuf::types::ProtobufTypeString> = ::protobuf::ext::ExtFieldOptional { field_number: 51234, phantom: ::std::marker::PhantomData }; line 2094 of the generated file (avaliable here)
(pub const type: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, ::protobuf::types::ProtobufTypeString> = ::protobuf::ext::ExtFieldOptional { field_number: 51234, phantom: ::std::marker::PhantomData };
Proto file:
syntax = "proto2"; import "google/protobuf/descriptor.proto"; extend google.protobuf.EnumValueOptions { optional string type= 51234; optional string code= 51235; } package pubsub.pb; message RPC { repeated SubOpts subscriptions = 1; repeated Message publish = 2; message SubOpts { optional bool subscribe = 1; // subscribe or unsubcribe optional string topicid = 2; } optional ControlMessage control = 3; } message Message { optional bytes from = 1; optional bytes data = 2; optional bytes seqno = 3; repeated string topicIDs = 4; // TODO: use // optional bytes signature = 5; // optional bytes key = 6; } message ControlMessage { repeated ControlIHave ihave = 1; repeated ControlIWant iwant = 2; repeated ControlGraft graft = 3; repeated ControlPrune prune = 4; } // While this may not be strictly necessary as a messageID and a messageHash // are both strings, it would be useful to differentiate between them in the // protobuf file, e.g. due to the accessors and for clarity. enum MessageRep { ID = 0 [(type) = "ID", (code) = 'I']; HASH = 1 [(type) = "HSH", (code) = 'H']; } message ControlIHave { optional string topicID = 1; // We could have a repeated string messageIDs field and repeated string // messageHash field here, which would be better for backwards // compatibility, although hiding both behind one type has its advantages. repeated MessageRep mRep = 2; } message ControlIWant { repeated string MessageRep = 1; } message ControlGraft { optional string topicID = 1; } message ControlPrune { optional string topicID = 1; } message TopicDescriptor { optional string name = 1; // TODO: use // optional AuthOpts auth = 2; // optional EncOpts enc = 3; // message AuthOpts { // optional AuthMode mode = 1; // repeated bytes keys = 2; // root keys to trust // enum AuthMode { // NONE = 0; // no authentication, anyone can publish // KEY = 1; // only messages signed by keys in the topic descriptor are accepted // WOT = 2; // web of trust, certificates can allow publisher set to grow // } // } // message EncOpts { // optional EncMode mode = 1; // repeated bytes keyHashes = 2; // the hashes of the shared keys used (salted) // enum EncMode { // NONE = 0; // no encryption, anyone can read // SHAREDKEY = 1; // messages are encrypted with shared key // WOT = 2; // web of trust, certificates can allow publisher set to grow // } // } }
The text was updated successfully, but these errors were encountered:
5162d0f
Escape extension field names
3097d62
Fixes #371
Published version 2.2.5. Thank you for the bugreport!
Sorry, something went wrong.
Thank you!
No branches or pull requests
Basically the generated code is using the illegal keyword
type
in place of a variable representing the type of a Rust enum field.Rust compiler error in generated proto file:
Full line:
(pub const type: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::EnumValueOptions, ::protobuf::types::ProtobufTypeString> = ::protobuf::ext::ExtFieldOptional { field_number: 51234, phantom: ::std::marker::PhantomData };
line 2094 of the generated file (avaliable here)Proto file:
The text was updated successfully, but these errors were encountered: