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

Feat/http transcoding (Continuation) #351

Merged
merged 75 commits into from Mar 25, 2024

Conversation

sleipnir
Copy link
Collaborator

@sleipnir sleipnir commented Feb 16, 2024

This PR continues the excellent work started by @drowzy in his PR #273. The merit of this work must be given entirely to @drowzy.

I just made some small fixes and eliminated all the deprecated code from the Protobuf api, as well as merging it with the recent codebase and fixing some tests.

I hope @drowzy doesn't mind that I picked up where he left off. But I accept it if you don't want to continue with this PR here. Again I reiterate that he did an excellent job in his previous PR.

closes #273

Below is the text copied from the original PR (#273):

Support for gRPC transcoding.

This feature is opt-in using the http_transcode option in the server definition:

defmodule Helloworld.Greeter.Server do
  use GRPC.Server,
    service: Helloworld.Greeter.Service,
    http_transcode: true

Request/response mapping can be controlled by adding grpc-gateway annotations to your proto definition:

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

package helloworld;

// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {
    option (google.api.http) = {
      get: "/v1/greeter/{name}"
    };
  }

  rpc SayHelloFrom (HelloRequestFrom) returns (HelloReply) {
    option (google.api.http) = {
      post: "/v1/greeter"
      body: "*"
    };
  }
}

This PR does not require any changes to user code.

For a full list of features see #273

drowzy and others added 30 commits September 8, 2022 14:46
Routes are fetched from server and compiled into a dispatch conf.
Instead of finding a matching server in the handler the path is matched
and the handler is called with the correct server.
@sleipnir
Copy link
Collaborator Author

sleipnir commented Mar 4, 2024

ping @polvalente @drowzy

lib/grpc/codec/json.ex Outdated Show resolved Hide resolved
lib/grpc/codec/json.ex Outdated Show resolved Hide resolved
lib/grpc/server.ex Outdated Show resolved Hide resolved
@polvalente polvalente merged commit 8aaf3d3 into elixir-grpc:master Mar 25, 2024
16 checks passed
@sleipnir
Copy link
Collaborator Author

Thank you @polvalente

@fahchen fahchen mentioned this pull request Apr 8, 2024
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

Successfully merging this pull request may close these issues.

Add gRPC http/json transcoding support Support access to MethodOptions fields
3 participants