Skip to main content

gRPC Schema ([grpc])

When protocol = "grpc" is specified, Rumour bypasses standard HTTP/1.1 parsing and establishes a binary HTTP/2 multiplexed channel. The [grpc] block is strictly required to instruct Rumour on how to compile your Protocol Buffers (.proto files) on the fly.


Actionable Quickstart​

Want to test this schema right now? You can run it against the official rumour-mock-server repository.

1. Start the Mock Server​

In a new terminal window, boot up the multi-protocol mock server (provides a gRPC EchoService on port 50051):

cd rumour-mock-server/mock-server
npm install
npm start

2. Scaffold a Workspace​

In your main terminal, initialize a fresh testing workspace:

mkdir try_grpc
cd try_grpc
rumour init
rumour new grpc_tests

3. Create the Request File​

The mock server already provides an echo.proto on its gRPC port. Paste this complete request into grpc_tests/request.toml:

name = "quickstart_grpc"
protocol = "grpc"

[request]
url = "grpc://localhost:50051"

[grpc]
# For this quickstart, you can leave the proto_file path empty if testing against a Reflection-enabled server,
# or grab echo.proto from the mock-server repo!
proto_file = "../../rumour-mock-server/mock-server/echo.proto"
service = "echo.EchoService"
method = "Echo"

[grpc.request_json]
message = "Hello Actionable Quickstart!"
value = 42

[assert]
grpc_status = 0

4. Run the Test​

Execute the test. Rumour will compile the protobufs in-memory, hit the gRPC server, and validate the binary response!

rumour run grpc_tests/ -v

Root Parameters​

FieldTypeRequiredDescription
proto_fileStringYesRelative or absolute path to the .proto file defining your service schema.
serviceStringYesThe exact name of the gRPC service (must include the package name if defined).
methodStringYesThe specific RPC method to invoke.
deadline_msIntegerNoEnforces a strict timeout deadline for the RPC call (Defaults to 5000).

Service Name Resolution​

caution

If your .proto file declares a package, you must prefix the service name with the package. For example, if package auth; is defined, your service should be auth.AuthService, not just AuthService.

[grpc]
proto_file = "../../protos/authentication.proto"
service = "auth.AuthService"
method = "VerifyToken"
deadline_ms = 2000

Metadata ([grpc.metadata])​

In gRPC, you do not use standard HTTP headers. Instead, you pass key-value pairs via Metadata. The [grpc.metadata] table functions exactly like headers.

[grpc.metadata]
authorization = "Bearer {{jwt_token}}"
x-client-version = "1.0.4"

The Payload ([grpc.request_json])​

Because Protocol Buffers are compiled into unreadable binary, Rumour allows you to write your payloads in standard JSON format. The [grpc.request_json] table is dynamically validated against your .proto schema and binary-encoded right before execution.

# Assuming the protobuf expects: message TokenRequest { string token = 1; bool force_refresh = 2; }
[grpc.request_json]
token = "abc-123"
force_refresh = true

Handling Complex Protobuf Types​

  • Repeated Fields: Pass a standard TOML array (ids = [1, 2, 3]).
  • Map Fields: Pass a nested TOML table ([grpc.request_json.tags]).
  • Enums: Pass the exact string representation of the Enum (e.g., status = "ACTIVE"). Rumour will resolve it to the underlying integer automatically.