Never mind guys, just found the answer though trial and error hehehehe

And for anyone that might need it, the answer is:

message MyMessage {

  optional string my_another_field = 1 [(Index) = { IndexDefinitions : {Name
: "val1", other properties}, IndexDefinitions : {Name: "val2", other 
properties}, IndexDefinitions : {Name: "val3", other properties} } ];
}


Regards
On Monday, February 13, 2017 at 2:30:06 PM UTC+1, jhon...@reto.dk wrote:
>
> Hi all,
>
> I am customizing our parser, and we need the custom option to be a message 
> instead of a type, is that possible?
>
> Ex:
> If we needed a custom option to be a repeated/list we could do the 
> following:
>
> message IndexMessage {
>   repeated string Names = 1;
> }
>  
> extend google.protobuf.FieldOptions {
>   optional IndexMessage Index = 50002;
> }
>  
> message MyMessage {
>   optional string my_another_field = 1 [(Index) = { Names : ["val1", 
> "val2", "val3"] } ];
> }
>
> Now, let's say Names is a property of another message type, like:
>
> message IndexMessage {
>   repeated IndexDef IndexDefinitions = 1;
> }
>
> message IndexDef{
>   required Name = 1;
>   // other needed options//
> }
>  
> extend google.protobuf.FieldOptions {
>   optional IndexMessage Index = 50002;
> }
>
> Now, if this is possible, how can I declare this on my message? (I got up 
> to this point and still generate, after that, everything I tried wouldn't 
> compile)
>
> message MyMessage {
>   optional string my_another_field = 1 [(Index) = { IndexDefinitions : {} 
> } ];
> }
>
>
>
> Best Regards
>

-- 
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