-
Notifications
You must be signed in to change notification settings - Fork 25
ViewNameConflict: codegen fails when message FooView exists alongside message Foo #32
Description
Summary
buffa-build returns a ViewNameConflict error when a proto package contains both a message Foo and a message FooView, because buffa generates a view type named FooView for message Foo that collides with the user-defined FooView message.
This is valid protobuf. The workaround is .generate_views(false), but that disables views for the entire crate.
Minimal reproducer
syntax = "proto3";
package test;
message Warning {
string text = 1;
}
message WarningView {
string text = 1;
int32 severity = 2;
}// build.rs
fn main() {
buffa_build::Config::new()
.files(&["view_conflict.proto"])
.includes(&["."])
.compile()
.unwrap();
}Error
ViewNameConflict { scope: "test", owned_msg: "Warning", view_msg: "WarningView" }
Expected behavior
Code generation should succeed. The generated view type for Warning could be disambiguated — for example by renaming it on conflict to WarningBorrowView, WarningRef, or placing it in a sub-module.
Impact
Low — in a ~7k proto file corpus this only affected 2 packages. The per-crate .generate_views(false) workaround is sufficient, but it would be nice to not lose views for those crates.
Version
buffa 0.3.0 (built from source, main branch)