google / google/protobuf.dart

Add service name in generated gRPC code

Open
#227 0 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
Dart
Stars
572
Forks
196
Avg merge
1h 59m
Merged PRs (30d)
2

Description

When doing a [gRPC health check](https://github.com/grpc/grpc/blob/master/src/proto/grpc/health/v1/health.proto), we can specify the service name to check. However, there's no way to extract that from the generated code on the client without creating a stub server, e.g.

```dart
doHealthCheck() {
final client = HealthClient(channel, options: defaultCallOptions);
final healthResponse = await client.check(
HealthCheckRequest()
..service = StubChessService().$name
..freeze());
}

class StubChessService extends ChessService {
...
}
```

It would be helpful to have a static serviceName on the generated client to avoid magic strings or creating stubs.

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.