1/* This is the first detached comment for the syntax. */ 2 3/* This is a second detached comment. */ 4 5/* This is a third. */ 6 7/* Syntax comment... */ 8syntax = "proto2"; /* Syntax trailer. */ 9 10/* And now the package declaration */ 11package foo.bar; 12 13import "desc_test_options.proto"; 14 15import "google/protobuf/empty.proto"; 16 17/* option comments FTW!!! */ 18option go_package = "github.com/jhump/protoreflect/internal/testprotos"; 19 20message AnEmptyMessage { 21} 22 23/* 24 * Multiple white space lines (like above) cannot 25 * be preserved... 26 */ 27 28/* We need a request for our RPC service below. */ 29message Request { 30 option deprecated = true; /* deprecated! */ 31 32 /* lead mfubar */ 33 option (testprotos.mfubar) = true; /* trailing mfubar */ 34 35 /* A field comment */ 36 repeated int32 ids = 1 [json_name = "|foo|", packed = true, (testprotos.ffubar) = "abc", (testprotos.ffubarb) = "xyz"]; /* field trailer #1... */ 37 38 /* some detached comments */ 39 40 /* some detached comments */ 41 42 /* Another field comment */ 43 44 /* label comment */ 45 optional string name = 2 [default = "fubar"]; 46 47 /* Group comment */ 48 optional group Extras = 3 { 49 option no_standard_descriptor_accessor = false; 50 51 /* this is a custom option */ 52 option (testprotos.mfubar) = false; 53 54 optional double dbl = 1; 55 56 optional float flt = 2; 57 58 /* Leading comment... */ 59 optional string str = 3; /* Trailing comment... */ 60 } 61 62 /* can be this or that */ 63 oneof abc { 64 string this = 4; 65 66 int32 that = 5; 67 } 68 69 /* can be these or those */ 70 oneof xyz { 71 string these = 6; 72 73 int32 those = 7; 74 } 75 76 /* map field */ 77 map<string, string> things = 8; 78 79 enum MarioCharacters { 80 /* allow_alias comments! */ 81 option allow_alias = true; 82 83 option (testprotos.efubar) = 123; 84 85 option (testprotos.efubars) = -321; 86 87 SNIFIT = -101; 88 89 MARIO = 1 [(testprotos.evfubar) = 278, (testprotos.evfubars) = -314]; 90 91 LUIGI = 2 [(testprotos.evfubaru) = 200, (testprotos.evfubaruf) = 100]; 92 93 PEACH = 3; 94 95 BOWSER = 4; 96 97 WARIO = 5; 98 99 WALUIGI = 6; 100 101 HEY_HO = 7; 102 103 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 104 105 KAMEK = 8; 106 107 MAGIKOOPA = 8; 108 } 109 110 extensions 100 to 200; 111 112 extensions 201 to 250 [(testprotos.exfubar) = "splat!", (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007"]; 113 114 reserved 10 to 20, 30 to 50; 115 116 reserved "bar", "baz", "foo"; 117} 118 119/* Service comment */ 120service RpcService { 121 option deprecated = false; /* DEPRECATED! */ 122 123 /* option that sets field */ 124 option (testprotos.sfubar) = { id:100 name:"bob" }; 125 126 option (testprotos.sfubare) = VALUE; 127 128 /* Method comment */ 129 rpc StreamingRpc ( stream Request ) returns ( Request ); 130 131 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 132 option deprecated = true; 133 134 option (testprotos.mtfubar) = 12.340000; 135 136 option (testprotos.mtfubard) = 123.456000; 137 } 138} 139 140extend Request { 141 /* comment for guid1 */ 142 optional uint64 guid1 = 123; 143 144 /* ... and a comment for guid2 */ 145 optional uint64 guid2 = 124; 146} 147