Skip to content

Commit

Permalink
Handle message deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Dec 29, 2023
1 parent 89fd765 commit a1bf888
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions protoc_plugin/lib/src/message_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ class MessageGenerator extends ProtobufContainer {
commentBlock = '$commentBlock\n';
}

if (_descriptor.options.deprecated) {
out.println(
'@$coreImportPrefix.Deprecated(\'This message is deprecated\')');
}
out.addAnnotatedBlock(
'${commentBlock}class $classname extends $protobufImportPrefix.$extendedClass$mixinClause {',
'}', [
Expand Down
1 change: 1 addition & 0 deletions protoc_plugin/test/goldens/deprecations
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:protobuf/protobuf.dart' as $pb;

export 'deprecations.pbenum.dart';

@$core.Deprecated('This message is deprecated')
class HelloRequest extends $pb.GeneratedMessage {
factory HelloRequest() => create();
HelloRequest._() : super();
Expand Down

0 comments on commit a1bf888

Please sign in to comment.