Skip to content

Instantly share code, notes, and snippets.

@SnewsButton
Last active July 21, 2018 14:41
Show Gist options
  • Save SnewsButton/91901ac8a0ea63c474ac673457d05e45 to your computer and use it in GitHub Desktop.
Save SnewsButton/91901ac8a0ea63c474ac673457d05e45 to your computer and use it in GitHub Desktop.
Pact gRPC Implementation Investigation

Purpose

Add gRPC support to Pact.

Intro

gRPC

We should note that there are four kinds of services:

  • Unary RPCs
  • Server streaming RPCs
  • Client streaming RPCs
  • Bidirectional streaming

Protos

Should they be included in the formulation of the consumer contract?

Problem Statement

TODO: Specify what a successful implemtation of gRPC support in Pact looks like

Options

grpc-gateway

As suggested by @bootstraponline, we should look into https://github.com/grpc-ecosystem/grpc-gateway. Since grpc-gateway converts to rest, it seems that some of the streaming services may not translate well. Additionally, this requires existence of protos and annotations.

Would be used in provider tests

Consumer

Provider

@SnewsButton
Copy link
Author

SnewsButton commented Jul 9, 2018

grpc-gateway requires existence of proto files and annotations. We could generate the annotations semi automatically, first specifying the proto files to be included and methods for each associated rpc (see above). If that can be accomplished, then I think that we can still test via REST in the consumer side.

@SnewsButton
Copy link
Author

Seems that we do not have to annotate the proto file: this would be a better option. See https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html

@SnewsButton
Copy link
Author

@mecavity
Copy link

Very cool @SnewsButton! Really excited by this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment