connectrpc-build: option to generate client code only

Aperta
#360 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start by tracing how Config::gate_client_feature is passed into code generation and how the plugin handles its existing option. Then locate the generator paths for service traits, ServiceExt, server types, dispatch, and clients; the payload does not name their files or tests. Done means generate_server(false) (and plugin option no_server) emits the requested client-side code without server code, while the default keeps server generation enabled.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A crate that only calls a service still gets the server trait, …ServiceExt, …Server<T> and their dispatch generated, and must compile them. That costs build time and code size, and server-side name clashes (#309; RPCs named like clone/into/as_ref) break crates that never implement the service.

Minimal proto:

syntax = "proto3";
package demo.v1;
message Req {}
message Resp {}
service DemoService {
  rpc Register(Req) returns (Resp);
}

connectrpc_build::Config::new().files(&["demo.proto"]).includes(&["."]).gate_client_feature(true).compile() then include! of the output fails with E0061 in the generated dispatch, though only DemoServiceClient is used.

Proposal: Config::generate_server(bool) (plugin option no_server), default true. When false, emit messages, views, Encodable impls where needed, and FooClient<T> only. This mirrors gate_client_feature, which already exists for the opposite direction.

Lingua principale
Rust
Stelle
544
Fork
77
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di connectrpc/connect-rust

Tutte le issue di connectrpc/connect-rust

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.