grpc / grpc/grpc-rust

build: Support deprecated attribute for rpc

Open
#1,512 0 comments 1 reaction 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.