My proto file looks something like:
message Ack {
bool required = 1;
optional string address = 2;
}
It looks like I am not able to name my variable as 'required' because its already been reserved by GRPC server system. Can anyone please guide me how to create a variable that has a name "required" instead of requiring a variable?
Please include more details in your question:
I suspect the issue arises at the protocol buffer rather than gRPC layer and probably when you attempt to compile the protos using
protoc.requiredis a reserved word for protocol buffers versionproto2but not (currently?) inproto3.Compilers and other tools fail to parse sources that include reserved words in unexpected locations. Even if you can get such sources to compile, it's not good practice to try to abuse this practice because it could result in unexpected behavior elsewhere.
You should consider using an alternative name:
required__requiredis_requiredUsing the latest version of
protocreleasev21.2and generated Golang sources, I'm able to compile proto2 and proto3 sources that include a field calledrequired:And: