Skip to content

gRPC support in .http (GRPC method, reflection, streaming via ===) #13

@syncended

Description

@syncended

Goal

Extend yapi to send gRPC calls using the same `.http` file format, mirroring IntelliJ HTTP Client's gRPC syntax for compatibility.

Status

v0.2 feature. Depends on saved-requests format (#11) being live and parser-tolerant of arbitrary uppercase methods + `# @key value` metadata (already required for v0.1.0).

Syntax

```http

Unary call

GRPC localhost:50051/helloworld.Greeter/SayHello
authorization: Bearer {{token}}

{ "name": "world" }
```

  • Method: `GRPC` (use `grpcs://` URL scheme or `# @grpc-tls` for TLS).
  • URL: `host:port/<fully.qualified.Service>/`.
  • Headers = gRPC metadata.
  • Body: JSON, mapped to protobuf via `JsonFormat`.
  • Streaming: messages separated by `===` (client/bidi streaming → multiple request messages; server/bidi → multiple response messages).

Schema source

  • Default: gRPC server reflection (`grpc.reflection.v1alpha.ServerReflection`).
  • Override per-request: `# @grpc-proto ./protos/foo.proto` + `# @grpc-import-path ./protos`.
  • Global defaults in `config.toml`:
    ```toml
    [grpc]
    reflection = true
    proto_paths = ["./protos"]
    ```

Tech stack (proposed)

  • `io.grpc:grpc-netty-shaded`, `grpc-protobuf`, `grpc-services` (reflection client).
  • `com.google.protobuf:protobuf-java-util` for JSON ↔ `DynamicMessage`.

Out of scope

  • Code-gen of Kotlin stubs from `.proto` (we use `DynamicMessage` for runtime flexibility).
  • gRPC-Web.

Acceptance criteria

  • A `.http` file with `GRPC` method executes a real unary call against a server with reflection enabled.
  • Local `.proto` path works as a fallback when reflection is disabled.
  • Server-streaming, client-streaming, and bidi modes all work; multiple messages are rendered with `===` separator on output.
  • Existing v0.1.0 `.http` files for HTTP requests keep working unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions