views:

87

answers:

1

In protocol buffers is there a way to have a message with collection of nested messages? For example a message Supervisor might have a collection of Employees along with the name and department of the supervisor.

+2  A: 

Yes. You use repeated fields;

message Employee
{
    ...
}

message Supervisor
{
    repeated Employee employees = 1;
}

You can then access the employees field as a list.

JesperE

related questions