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
I'm building .rs files from .proto files and using type_attribute to add some extra attributes to the .rs files.
Trying to use type_attribute multiple times seems to not work. Only the last type_attribute set is kept.
I'm using the same path on both type attributes; not sure if this is related to the issue or this is a misuse of such method.
Doing the same using tonic-build 0.4 shows the expected behaviour.
Version
tonic-build v0.5.0
Platform
Darwin computer.local 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64
Crates
tonic-build
Description
I tried this code:
fnmain() -> Result<(),Box<dyn std::error::Error>>{
tonic_build::configure().out_dir("proto/helloworld/").type_attribute(".","// first attribute").type_attribute(".","// second attribute").build_server(false).compile(&["proto/helloworld/helloworld.proto"],&["proto/helloworld"],)?;Ok(())}
This is a brand new cargo new tonic-build project with only tonic-build as dependency:
I expected to see both "// first attribute" and "// second attribute" on the generated code.
Instead, I only see "// second attribute" on the generated code.
If I swap the type_attribute invocations, I only see "// first attribute" and not "// second attribute".
am I doing something wrong? Same code is working on tonic-build 0.4
as a workaround, I'm using something like:
.type_attribute(".","// first attribute\n// second attribute")
The text was updated successfully, but these errors were encountered:
That appears to be a bug in prost then. Tonic just forwards those attributes directly here. If you use prost-build directly, without tonic-build, does it work as expected?
Bug Report
I'm building .rs files from .proto files and using
type_attribute
to add some extra attributes to the .rs files.Trying to use
type_attribute
multiple times seems to not work. Only the last type_attribute set is kept.I'm using the same path on both type attributes; not sure if this is related to the issue or this is a misuse of such method.
Doing the same using tonic-build 0.4 shows the expected behaviour.
Version
tonic-build v0.5.0
Platform
Darwin computer.local 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64
Crates
tonic-build
Description
I tried this code:
This is a brand new
cargo new tonic-build
project with only tonic-build as dependency:I expected to see both "// first attribute" and "// second attribute" on the generated code.
Instead, I only see "// second attribute" on the generated code.
If I swap the type_attribute invocations, I only see "// first attribute" and not "// second attribute".
am I doing something wrong? Same code is working on tonic-build 0.4
as a workaround, I'm using something like:
The text was updated successfully, but these errors were encountered: