Skip to content

drpc: add unit tests for protoc-gen-go-drpc HTTP gateway route generator #170333

@shubhamdhama

Description

@shubhamdhama

Background

cockroachdb/drpc#56 added the protoc-gen-go-drpc generator feature that reads google.api.http annotations from proto method options and emits DRPCGatewayRoutes functions in the generated *_drpc.pb.go files. Each function returns a []drpc.HTTPRoute containing the HTTP method, path, and a reference to the corresponding RPC client method.

The PR shipped without unit tests for the generator itself.

Task

Add unit tests for the protoc-gen-go-drpc generator covering the HTTP gateway route generation logic, including:

  • Correct emission of DRPCGatewayRoutes for methods with google.api.http annotations
  • Skipping of streaming RPCs
  • Skipping of methods without HTTP annotations
  • Edge cases (multiple HTTP bindings, nested path params, etc.)

Notes

This should be relatively low-effort — a good candidate for Claude Code to scaffold the test suite. The generator logic lives in the cockroachdb/drpc repo but the tracking issue is here since that's where we manage DRPC-related work.

References

Jira issue: CRDB-63937

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-db-server

    Type

    No type
    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