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