aboutsummaryrefslogtreecommitdiff
path: root/csharp/protos/unittest_proto3.proto
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2018-08-30 14:53:06 +0100
committerJon Skeet <skeet@pobox.com>2018-09-22 09:09:15 +0100
commit1711999078ca1d435de3958bf963e95a742e972f (patch)
tree6ea6797a824da7cf26b2535ea4e3a9be9cd5ec95 /csharp/protos/unittest_proto3.proto
parenta6e1cc7e328c45a0cb9856c530c8f6cd23314163 (diff)
downloadprotobuf-1711999078ca1d435de3958bf963e95a742e972f.tar.gz
protobuf-1711999078ca1d435de3958bf963e95a742e972f.tar.bz2
protobuf-1711999078ca1d435de3958bf963e95a742e972f.zip
Provide simple access to descriptor declarations in C#
This is primarily for access to comments, which would be expected to be available in a protoc plugin. The implementation has two fiddly aspects: - We use a Lazy<T> to avoid building the map before cross-linking. An alternative would be to crosslink at the end of the constructor, and remove the calls to CrossLink elsewhere. This would be generally better IMO, but deviate from the Java code. - The casts to IReadOnlyList<DescriptorBase> are unfortunate. They'll always work, because these lists are always ReadOnlyCollection<T> for a descriptor type... but we can't use IList<DescriptorBase> as that's not covariant, and it's annoyingly fiddly to change the field to be of type ReadOnlyCollection<T>.
Diffstat (limited to 'csharp/protos/unittest_proto3.proto')
-rw-r--r--csharp/protos/unittest_proto3.proto30
1 files changed, 30 insertions, 0 deletions
diff --git a/csharp/protos/unittest_proto3.proto b/csharp/protos/unittest_proto3.proto
index ef4933a5..bf88f6bc 100644
--- a/csharp/protos/unittest_proto3.proto
+++ b/csharp/protos/unittest_proto3.proto
@@ -368,7 +368,9 @@ message FooResponse {}
message FooClientMessage {}
message FooServerMessage{}
+// This is a test service
service TestService {
+ // This is a test method
rpc Foo(FooRequest) returns (FooResponse);
rpc Bar(BarRequest) returns (BarResponse);
}
@@ -378,3 +380,31 @@ message BarRequest {}
message BarResponse {}
message TestEmptyMessage {}
+
+// This is leading detached comment 1
+
+// This is leading detached comment 2
+
+// This is a leading comment
+message CommentMessage {
+ // Leading nested message comment
+ message NestedCommentMessage {
+ // Leading nested message field comment
+ string nested_text = 1;
+ }
+
+ // Leading nested enum comment
+ enum NestedCommentEnum {
+ // Zero value comment
+ ZERO_VALUE = 0;
+ }
+
+ // Leading field comment
+ string text = 1; // Trailing field comment
+}
+
+// Leading enum comment
+enum CommentEnum {
+ // Zero value comment
+ ZERO_VALUE = 0;
+}