You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codegen: check message and enum names against service-derived items #330
In connectrpc-build output a package's messages and enums share a Rust module with its service stubs. check_module_collisions (#280) compares the identifiers derived from one service with those derived from another, and does not look at message or enum names. A message named like a service-derived item is accepted at generation time, and the generated code then fails to compile:
error[E0428]: the name `GreetClient` is defined multiple times
The types a service Greet derives are Greet, GreetExt, GreetServer, GreetClient and GreetRegisterMarker. Its constants are values, which a message or enum does not collide with. The Owned<Message>View aliases are types in the same module, so message OwnedSayRequestView collides with the alias for SayRequest; the alias check from #77 compares aliases with each other only.
The split layout (buf generate with separate proto and connect trees) is not affected, because messages are in a different module there.
Proposed: before the per-service pass, record the package's top-level message and enum names in BatchState::module_idents, so that the existing check reports the pair with both proto names, as it does for two services. Only the unified layout needs it.
#329 documents the limit in docs/guide.md; the fix removes that sentence.
Activity