Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugins/anthropics/connect-rust/source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source:
crates:
crate_name: connectrpc-codegen
2 changes: 2 additions & 0 deletions plugins/anthropics/connect-rust/v0.3.2/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
17 changes: 17 additions & 0 deletions plugins/anthropics/connect-rust/v0.3.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# syntax=docker/dockerfile:1.19
FROM rust:1.91.1-alpine3.22 AS builder
RUN apk add --no-cache musl-dev
WORKDIR /app
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
# The protoc-gen-connect-rust binary is a [[bin]] target in the
# connectrpc-codegen crate. cargo install compiles it by crate name.
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \
cargo install connectrpc-codegen --version 0.3.2 --locked --root /app

FROM gcr.io/distroless/static-debian12:latest@sha256:87bce11be0af225e4ca761c40babb06d6d559f5767fbf7dc3c47f0f1a466b92c AS base

FROM scratch
COPY --link --from=base / /
COPY --link --from=builder /app/bin/protoc-gen-connect-rust /protoc-gen-connect-rust
USER nobody
ENTRYPOINT ["/protoc-gen-connect-rust"]
40 changes: 40 additions & 0 deletions plugins/anthropics/connect-rust/v0.3.2/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: v1
name: buf.build/anthropics/connect-rust
plugin_version: v0.3.2
source_url: https://github.com/anthropics/connect-rust
description: Generates ConnectRPC service traits, typed clients, and monomorphic dispatchers for Rust. Compatible with the Connect, gRPC, and gRPC-Web protocols. Passes the full ConnectRPC conformance suite.
deps:
- plugin: buf.build/anthropics/buffa:v0.3.0
output_languages:
- rust
spdx_license_id: Apache-2.0
license_url: https://github.com/anthropics/connect-rust/blob/v0.3.2/LICENSE
registry:
cargo:
rust_version: "1.88"
deps:
# ConnectRPC runtime: Router, Context, ConnectError, client transports.
# https://github.com/anthropics/connect-rust/blob/v0.3.2/connectrpc/Cargo.toml
- name: "connectrpc"
req: "0.3.2"
default_features: true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

silly non-expert-in-rust question: I see the default features; those don't include the tls feature, but is that just something that is "enabled" by having the various "deps" in the sub-features installed? (Mostly trying to confirm that someone consuming this generated SDK could still use the TLS features.)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude code] Yes — Cargo features are additive and unified per-crate across the dependency graph. The generated SDK crate only needs connectrpc's default features for the generated code to compile, so that's all it declares. A consumer who wants TLS adds their own direct dependency in their application's Cargo.toml:

connectrpc = { version = "0.4", features = ["tls"] }

Cargo then compiles connectrpc once with the union of features requested by both the SDK crate and the application, so tls (and client-tls / server-tls / any other optional feature) is fully available. Same model the tonic SDK crates use — the SDK doesn't gate runtime features.

# Generated service stubs use buffa::Message, buffa::view::OwnedView,
# buffa::bytes::Bytes directly. Message types live in the buffa SDK
# crate (via the plugin dep above); this dep is for the runtime API.
- name: "buffa"
req: "0.3.0"
default_features: true
# Streaming method signatures use futures::Stream.
- name: "futures"
req: "0.3"
default_features: true
# Client transport bounds reference http_body::Body.
- name: "http-body"
req: "1"
default_features: true
# The plugin accepts `extern_path=.=<rust_path>` (or the shorthand
# `buffa_module=<rust_path>`) to tell it where the buffa-generated message
# types live. BSR should inject this based on the buffa dep's SDK crate
# name, same as tonic receives extern_path for its prost dep. Leaving
# opts empty here; please advise if an explicit entry is needed.
opts: []
Comment on lines +35 to +40
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fine to leave this empty, and the BSR will figure out extern_path settings using the prost syntax 👍.