build: Support deprecated attribute for rpc
- Dominant language
- Rust
- Stars
- 12.5k
- Forks
- 1.3k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 24
Description
## Feature Request
It would be useful to mark a deprecated rpc with the #[deprecated] attr on the rust method. In particular for the client method (but makes sense also for the server trait method).
### Crates
_tonic-build_
### Motivation
To allow deprecating rpc and communicating that in rust code.
### Proposal
```protobuf
service Foo {
// Deprecated. Use `Baz`.
rpc Bar(Msg) returns (Msg) {
option deprecated = true;
}
rpc Baz(Msg) returns (Msg);
}
message Msg {}
```
Currently generates `FooClient` code without any deprecated attr.
Instead _tonic-build_ should add the attr.
```rust
impl FooClient {
/// Deprecated. Use `Baz`.
#[deprecated]
pub async fn bar(
&mut self,
request: impl tonic::IntoRequest,
) -> Result, tonic::Status> {
...
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.