Hi,
I am new to protobuf. 
I have question related to specifying partial messages as RPC parameters 
and using scalar types in RPCs for returning simple strings
Why message wrappers are required?
Please clarify my doubts to decide better message specification
I have definition something like below

Option A

message Student
{
message Empty
{
}

//Name of the Student
optional string name = 1;
// Year of Passing
optional string YOP  = 2;
message Certificate
{
// Certificate name
optional string name    = 1;
// Absolute location of the file on the disk
// e.g. C:\university\2019\
optional string path    = 2;
//strudent Identification code
optional string ID      = 3;
// section e.g. "A", "B"
optional string section = 4;
// Certificate type
optional string type = 5;
}
optional Certificate cert = 3;
}
service StudentService
{
rpc getStudentName(Strudent.Empty) returns (Student);
rpc getCertificate(Student.Certificate) returns (Student.Certificate);
}

alternatively

Option B

message Student
{

//Name of the Student
optional string name = 1;

message FilePath
{
optional string path = 1;
}
message Certificate
{
optional string   name = 1;
optional Filepath path = 2;
//strudent Identification code
optional string ID      = 3;
// section e.g. "A", "B"
optional string section = 4;
// Certificate type
optional string type = 5;

}
optional Certificate cert = 2;
}
service StudentService
{
rpc getStudentName(Strudent.Empty) returns (Student);
rpc getCertificate(Student.Certificate.FilePath) returns 
(Student.Certificate);
}

In Option A, file path can not be specified to get the certificate. Full 
message needs to be passed.
In Option B, there is a extra type introduced to simplify
However it adds nested definition for path 
as it has to be cert.path.path for getters and setters 

Please clarify the following
Why scalar types can not be used as IN parameter or OUT parameters of 
Service RPCs?
How partial messages can be explicitly specified in service RPCs without 
using nesting?
What are the advantages and disadvantages of using message wrappers?
Regards
Ananya


 

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/544ad006-75ea-44fd-8e60-6d4db311f1ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to