Skip to content

feat(transcode): complete google.api.http mapping (query params, body, response_body, additional_bindings) #22

Description

@polaz

The transcoder currently treats the whole request body as the message and overlays path params. It ignores several core google.api.http mapping rules, which breaks drop-in compatibility with grpc-gateway / Envoy transcoder.

Gaps to close (Tier 0 — core correctness)

  1. Query-parameter binding — fields not bound by the path or body must be populated from the query string, coerced to the field's proto type (scalars, repeated → array, dotted nested paths). Today a GET /v1/x?limit=10 drops limit.
  2. body mapping — honor the rule's body: "*" (whole body → message root, current implicit behavior), "field" (body → that subfield), or empty (no body; fields from path+query only, e.g. GET/DELETE).
  3. response_body — when set, return that subfield of the response message as the HTTP body instead of the whole message.
  4. additional_bindings — register every additional (method, path, body) binding for the same RPC, not just the primary one.

Approach

  • Enrich the parsed HTTP rule into a list of bindings, each carrying method, path, body mapping, and response_body.
  • Factor request-message construction into pure, unit-tested helpers (body mapping + path + query overlay with proto-type coercion).
  • Extract response_body subfield on the unary response path.
  • Keep gRPC, streaming, CORS, health, etc. unchanged.

Acceptance

  • Unit tests for: body mapping (*/field/none), query coercion per kind, repeated + dotted query, response_body extraction.
  • Router builds with additional_bindings without panic; each binding routes.

Estimate: 1d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions