Skip to content

Method signature options with repeated field are not supported #113

@To-da

Description

@To-da

In case that message field (top level one) is specified as repeated and added as field in option (google.api.method_signature) then generated RPC call method argument is T (instead of Iterable or vararg) and it's set in the builder of the message as set* method (which have for collections 2 arguments - index & single item) instead of addAll* method.

Example:

message L1Message1{

    string field = 1;

    repeated string fields = 2;

    L2Nested1 nested_message = 3;

    message L2Nested1{
        string field =1;
        L1Message1 message_field =2;
    }

    message L2Nested2{
        string field = 1;
        L2Nested1 message_field =2;
    }
}

    rpc say_hello (L1Message1) returns (L1Message2){
        option (google.api.method_signature) = "field";
        option (google.api.method_signature) = "fields";
        option (google.api.method_signature) = "nested_message";
        option (google.api.method_signature) = "field,nested_message";
    };

Generated code (which of course cannot be compiled):

        suspend fun sayHello(fields: String): TestMessages.L1Message2 {
            val request = TestMessages.L1Message1.newBuilder()
                .setFields(fields)
                .build()
            return sayHello(request)
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions