Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method signature options with repeated field are not supported #113

Open
To-da opened this issue Jun 17, 2020 · 0 comments
Open

Method signature options with repeated field are not supported #113

To-da opened this issue Jun 17, 2020 · 0 comments

Comments

@To-da
Copy link

To-da commented Jun 17, 2020

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)
        }
@To-da To-da changed the title Method signature options with repeated field is not supported Method signature options with repeated field are not supported Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant