utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
290 stars 37 forks source link

Add support extended google.api.annotations with response field #39

Closed doroginin closed 6 years ago

doroginin commented 6 years ago

After this changes you can add binding with request/response mapping to repeated fields.

syntax = "proto3";

import "github.com/doroginin/grpc-gateway/third_party/googleapis/google/api/annotations.proto";

service Strings {
    rpc ToUpper (String) returns (String) {
        option (google.api.http) = {
            post: "/strings/to_upper"
            body: "str"
            response_body: "str"
        };
    }
}

message String {
    repeated string str = 1;
}

And in the result your request body will be: ["test","boo"] and response body will be: ["TEST","BOO"]

doroginin commented 6 years ago

Now also supported repeated field in GET See: integration/binding_with_body_and_response/pb/strings.proto GET request like this: /strings/to_upper/v2?str=test&str=boo