Hi guys,

I want to use protobufs on c++ for directly serializing some server 
requests into data objects. However, these requests share some common 
fields (eg: ts, auth-key, so on) - let's call them CommonParams

I will have multiple requests, eg: CreateAccountRequest, 
ReadAccountRequest, DeleteAccountRequest, which will all share the above 
common fields plus more.

Is there a way to merge a CommonParams's fields into a 
CreateAccountRequest, ReadAccountRequest? I also want the params to be on 
top level of the serialized JSON so no custom field of type CommonParams.

The only way I found was to serialize the CommonParams message and then to 
parse a new *Request message by parsing that serialized CommonParams. Of 
course, this means duplicating the CommonParams's fields into all of the 
*Request messages.

Any thoughts?

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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to