{"id":51563039,"url":"https://github.com/firetiger-oss/connect-aip","last_synced_at":"2026-07-10T12:02:32.299Z","repository":{"id":357775273,"uuid":"1227752757","full_name":"firetiger-oss/connect-aip","owner":"firetiger-oss","description":"Connect RPC → Google AIP REST codegen (Go/TS/Python plugins)","archived":false,"fork":false,"pushed_at":"2026-05-14T07:05:24.000Z","size":217,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-14T09:14:21.596Z","etag":null,"topics":["aip","buf","codegen","connect-rpc","connectrpc","go","golang","google-aip","grpc","protobuf","protoc","python","rest","rpc","typescript"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firetiger-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-03T05:44:49.000Z","updated_at":"2026-05-14T07:03:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/firetiger-oss/connect-aip","commit_stats":null,"previous_names":["firetiger-oss/connect-aip"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/firetiger-oss/connect-aip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconnect-aip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconnect-aip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconnect-aip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconnect-aip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firetiger-oss","download_url":"https://codeload.github.com/firetiger-oss/connect-aip/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firetiger-oss%2Fconnect-aip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35330738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aip","buf","codegen","connect-rpc","connectrpc","go","golang","google-aip","grpc","protobuf","protoc","python","rest","rpc","typescript"],"created_at":"2026-07-10T12:02:31.475Z","updated_at":"2026-07-10T12:02:32.290Z","avatar_url":"https://github.com/firetiger-oss.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# connect-aip\n\n[![ci](https://github.com/firetiger-oss/connect-aip/actions/workflows/ci.yml/badge.svg)](https://github.com/firetiger-oss/connect-aip/actions/workflows/ci.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/firetiger-oss/connect-aip.svg)](https://pkg.go.dev/github.com/firetiger-oss/connect-aip)\n\nConnect RPC → Google AIP-shaped REST codegen for Go, TypeScript, and Python.\n\n## Motivation\n\n[Connect RPC](https://connectrpc.com) speaks gRPC, gRPC-Web, and JSON-over-POST out of the box. None of these is the REST shape that browsers, third-party API consumers, and AIP-aligned API gateways expect: collection-rooted paths, AIP-160 filtering, AIP-158 pagination, idiomatic HTTP verbs.\n\n`connect-aip` fills the gap with three protoc plugins (`protoc-gen-aip-go`, `protoc-gen-aip-ts`, `protoc-gen-aip-py`) that read `google.api.http` annotations and emit AIP-130-style REST handlers and clients in three languages, plus a small Go and Python runtime that does the request forwarding.\n\nThe codegen is opinionated toward [Google AIP](https://google.aip.dev) conventions. Non-AIP `google.api.http` rules may technically work but are not the supported path; the design choice is reflected in the project's name.\n\nServer-streaming methods are routed through [`firetiger-oss/connect-sse`](https://github.com/firetiger-oss/connect-sse) so browsers can consume them over plain `fetch`.\n\n## Install\n\n### Go (codegen + runtime)\n\n```sh\ngo install github.com/firetiger-oss/connect-aip/cmd/protoc-gen-aip-go@latest\n```\n\nPrebuilt binaries for `linux/{amd64,arm64}` and `darwin/{amd64,arm64}` are attached to each [GitHub Release](https://github.com/firetiger-oss/connect-aip/releases).\n\n### TypeScript (codegen only — runtime is inlined)\n\n```sh\ngo install github.com/firetiger-oss/connect-aip/cmd/protoc-gen-aip-ts@latest\n```\n\n### Python (codegen + runtime)\n\n```sh\ngo install github.com/firetiger-oss/connect-aip/cmd/protoc-gen-aip-py@latest\npip install connectaip\n```\n\n## Usage\n\nAnnotate your Connect RPC service with `google.api.http` rules, then run any of the plugins via `buf`:\n\n```yaml\n# buf.gen.yaml\nplugins:\n  - local: protoc-gen-aip-go\n    out: proto/go\n    opt: [paths=source_relative]\n    strategy: all\n```\n\nFor each service with at least one usable HTTP rule, the Go plugin emits a `*_aip.connect.go` file alongside the standard `*.connect.go`, exposing `NewServiceAIPHandler` (an `iter.Seq2[string, http.Handler]` for `http.ServeMux`) and `NewServiceAIPClient` (a typed REST client wrapping `connect.HTTPClient`). `NewServiceAIPClient` returns the standard `ServiceClient` interface emitted by `protoc-gen-connect-go`, so you can drop it in wherever you currently call `NewServiceClient` — request headers set on `connect.Request[T]` propagate through to the outgoing HTTP request, and response headers populate `connect.Response[T]`.\n\nThe TypeScript plugin emits `*_aip.ts` with a `*AIPClient` class per service. The runtime is inlined into each generated file (no separate npm package). The class declares `implements Client\u003ctypeof Service\u003e` from `@connectrpc/connect`, so it's a drop-in replacement for a client built via `createClient(Service, transport)`. Consumers must add `@connectrpc/connect` and `@bufbuild/protobuf` to their package.\n\nThe Python plugin emits `*_aip.py` with a `*AIPClient` class per service that uses `httpx` for transport. Install the `connectaip` runtime alongside. Methods take raw protobuf messages, return raw protobuf messages, and accept a per-call `headers` kwarg — the same shape as a typical connect-python client.\n\n## OpenAPI spec generation\n\n`connect-aip` only emits language bindings. To publish the same REST surface as an OpenAPI document — for docs sites, Swagger UI, third-party SDK generators, gateway configs — pair it with [`sudorandom/protoc-gen-connect-openapi`](https://github.com/sudorandom/protoc-gen-connect-openapi). It reads the same `google.api.http` annotations and emits OpenAPI 3.1.\n\nInstall the plugin:\n\n```sh\ngo install github.com/sudorandom/protoc-gen-connect-openapi@latest\n```\n\nAdd a separate buf template so the OpenAPI generator runs alongside (not inside) your codegen template:\n\n```yaml\n# buf.openapi.yaml\nversion: v2\n\ninputs:\n  - directory: proto\n\nplugins:\n  - local: [protoc-gen-connect-openapi]\n    out: openapi\n    opt:\n      - format=yaml\n      - base=openapi-base.yaml\n      # Publish the REST surface only. RPCs without a google.api.http\n      # annotation are omitted from the spec — matching what connect-aip emits.\n      - only-googleapi-http\n    strategy: all\n```\n\nThe `only-googleapi-http` option is the key: it drops any RPC that doesn't carry an HTTP rule, so the OpenAPI document describes the exact same operations that `connect-aip` registers on the mux. Without it, the spec would advertise gRPC-only methods that have no REST endpoint.\n\n`base=openapi-base.yaml` lets you pin top-level fields (title, version, servers, security schemes) that the plugin merges into every generated document. A minimal base looks like:\n\n```yaml\n# openapi-base.yaml\nopenapi: 3.1.0\ninfo:\n  version: v1\n```\n\nThen run it as a separate step from your `buf.gen.yaml`:\n\n```sh\nbuf generate --template buf.openapi.yaml\n```\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiretiger-oss%2Fconnect-aip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiretiger-oss%2Fconnect-aip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiretiger-oss%2Fconnect-aip/lists"}