Skip to content

Commit

Permalink
Generate deprecated for services and service methods
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Dec 29, 2023
1 parent dea1a41 commit 84d9214
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions protoc_plugin/lib/src/client_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class ClientApiGenerator {
String get _clientType => '$protobufImportPrefix.RpcClient';

void generate(IndentingWriter out) {
if (service._descriptor.options.deprecated) {
out.println(
'@$coreImportPrefix.Deprecated(\'This service is deprecated\')');
}
out.addBlock('class ${className}Api {', '}', () {
out.println('$_clientType _client;');
out.println('${className}Api(this._client);');
Expand All @@ -41,6 +45,10 @@ class ClientApiGenerator {
final inputType = service._getDartClassName(m.inputType, forMainFile: true);
final outputType =
service._getDartClassName(m.outputType, forMainFile: true);
if (m.options.deprecated) {
out.println(
'@$coreImportPrefix.Deprecated(\'This method is deprecated\')');
}
out.addBlock(
'$asyncImportPrefix.Future<$outputType> $methodName('
'$protobufImportPrefix.ClientContext? ctx, $inputType request) =>',
Expand Down

0 comments on commit 84d9214

Please sign in to comment.