proto3 nested message creation error

message Action {

    int32 protocol_version = 1;
    int64 uid = 2; 
    int64 object_uid = 3; 
    ServiceType service_type = 4; 
    int32 left_messages = 5;
}

message SendTo {
    extend Action {
        SendTo action = 1010;
    }
}

If I tried to create message like above it gives error service_actions.proto:10:25: "com.sys.test.protocol.Action" does not declare 1010 as an extension number.

Any suggestion how to create such type of messages.

Answers


I think you forgot to add "extenssions" to root message. Like the following.

message Action {
     int32 protocol_version = 1;
     int64 uid = 2; 
     int64 object_uid = 3; 
     ServiceType service_type = 4; 
     int32 left_messages = 5;

     extensions 6 to max;
}

Need Your Help

How to ensure certain properties are always populated when returning object from DAL?

c# design-patterns data-access-layer

I have a Question class which has a property OptionList, which is nothing but a List. Questions and Options are stored in diff tables in the db.

Knockout Custom Binding does not Init sometimes

knockout.js requirejs bootstrap-modal

I created a knockout custom binding that helps enable bootstrap's modal functionality. However, sometimes the init method is not called when the markup uses the binding.