move-away-from-grpc-gateway

Migrate mockgcp services from grpc-gateway bindings to httptogrpc reflection.

1.1k|367|Updated Apr 8, 2019
One-click install
npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill move-away-from-grpc-gateway
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: move-away-from-grpc-gateway
Source: https://github.com/GoogleCloudPlatform/k8s-config-connector/tree/main/mockgcp/.gemini/skills/move-away-from-grpc-gateway
Command: npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill move-away-from-grpc-gateway

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you replace locally generated grpc-gateway proto bindings in mockgcp with reflection-based routing using the official Google Cloud Go client protos, reducing mismatch risk and aligning mock behavior with real clients.

Core Features & Use Cases

  • Stops grpc-gateway proto generation: Removes the target service from the grpc-gateway generation Makefile steps.
  • Cleans generated artifacts: Deletes the generated .pb.go, .pb.gw.go, and _grpc.pb.go outputs for all versions of the service.
  • Switches HTTP handling to httptogrpc: Replaces httpmux usage with httptogrpc.NewGRPCMux(conn) and updates header/error handling expectations.
  • Updates proto imports and types: Migrates Go code to cloud.google.com/go/<service>/apiv1/<service>pb and resolves any strict type differences during compilation.

Quick Start

Use the move-away-from-grpc-gateway skill to migrate a specific mockgcp service to httptogrpc by editing the Makefile, deleting generated grpc-gateway files, updating imports, and changing the NewHTTPMux implementation to register official gRPC clients with NewGRPCMux.

Frequently Asked Questions about move-away-from-grpc-gateway

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate a mockgcp service from grpc-gateway to httptogrpc reflection?

To migrate a mockgcp service from grpc-gateway to httptogrpc, you must stop proto generation in the Makefile, delete generated `.pb.go` and `.pb.gw.go` files, switch to official Google Cloud Go apiv1 protos, and rebuild the mux using `httptogrpc.NewGRPCMux`.

Why switch mockgcp HTTP-to-gRPC routing away from locally generated grpc-gateway bindings?

Switching away from locally generated grpc-gateway bindings reduces proto mismatch risk and aligns mock behavior with real clients by using official Google Cloud Go apiv1 client protos via httptogrpc reflection.

What generated files need to be deleted when stopping grpc-gateway proto generation for a GCP service?

When stopping grpc-gateway generation, you must delete the generated `.pb.go`, `.pb.gw.go`, and `_grpc.pb.go` outputs for all versions of the target GCP service to cleanly transition to httptogrpc.

How do I resolve proto type mismatches after switching imports to cloud.google.com/go apiv1 packages?

To resolve proto type mismatches after switching imports to `cloud.google.com/go/<service>/apiv1/<service>pb`, run `go build` and `go test` to identify strict type differences and fix them during compilation.

Does migrating mockgcp to httptogrpc require updating the NewHTTPMux implementation?

Yes, migrating mockgcp to httptogrpc requires replacing existing `httpmux` usage with `httptogrpc.NewGRPCMux(conn)` and updating header and error handling expectations to register official gRPC clients properly.

Can I migrate multiple versions of a mockgcp service away from grpc-gateway at the same time?

Yes, this migration applies to mockgcp HTTP-to-gRPC routing changes across one or more versions of a GCP service, requiring you to remove generation targets and delete generated grpc-gateway bindings for all affected versions.