If you're using proto2 then you can use extensions <https://developers.google.com/protocol-buffers/docs/proto#extensions> to allow clients to extend the base message with their own fields. The one caveat is that you have to figure out a scheme to ensure that each client chooses a unique extension number.
On Thu, Aug 27, 2020 at 6:16 PM Novice User <[email protected]> wrote: > My application has various clients (say for example Client1, Client 2, > Client3 ....and so on). Clients share some generic properties and has some > unique data. > > In my .proto file I want to model this kind of behavior. I came up with : > *message MyClientsData { * > * BaseClientData baseData; * > * Client1SpecificData client1; * > * Client2SpecificData client2;* > *... and so forth... * > *}* > > *BaseClientData* is the common data across all clients. > > This works for simple use case when number of clients are very limited, > but becomes hard to read if it grows. Is there some good practice on how to > handle this kind of situation when there are unique data across different > deserialization request? > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/1e6bc232-3271-4752-b48e-46cef09ae14en%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/1e6bc232-3271-4752-b48e-46cef09ae14en%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CADqAXr4OqvH4MoiVDq8jSkS%2B_aTwFMkKYiAGeHVOj5SB-uB%2BQw%40mail.gmail.com.
