elixir-grpc / grpc

An Elixir implementation of gRPC
https://hex.pm/packages/grpc
Apache License 2.0
1.4k stars 214 forks source link

Support access to MethodOptions fields #192

Closed sleipnir closed 7 months ago

sleipnir commented 3 years ago

Is your feature request related to a problem? Please describe. The option field in methods can be used to access contextual information. an example of this would http transcoding:

service ShoppingCart {
    rpc AddItem(AddLineItem) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            post: "/cart/{user_id}/items/add",
            body: "*",
        };
        option (.cloudstate.eventing).in = "items";
    }

    rpc RemoveItem(RemoveLineItem) returns (google.protobuf.Empty) {
        option (google.api.http).post = "/cart/{user_id}/items/{product_id}/remove";
    }

    rpc GetCart(GetShoppingCart) returns (Cart) {
        option (google.api.http) = {
          get: "/carts/{user_id}",
          additional_bindings: {
            get: "/carts/{user_id}/items",
            response_body: "items"
          }
        };
    }
polvalente commented 2 years ago

@sleipnir do you want to take this on?

sleipnir commented 2 years ago

@sleipnir do you want to take this on?

@polvalente I think we can close this one once the options have been added and that @drowzy is developing https://github.com/elixir-grpc/grpc/issues/274 via https://github.com/elixir-grpc/grpc/pull/273