github.com/jhump/protoreflect@v1.16.0/desc/protoprint/testfiles/test-preserve-doc-comments.proto (about) 1 syntax = "proto2"; 2 3 package foo.bar; 4 5 option go_package = "github.com/jhump/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 [ 17 packed = true, 18 json_name = "|foo|", 19 (testprotos.ffubar) = "abc", 20 (testprotos.ffubarb) = "xyz" 21 ]; 22 23 option (testprotos.mfubar) = true; 24 25 // label comment 26 optional string name = 2 [default = "fubar"]; 27 28 extensions 100 to 200; 29 30 extensions 201 to 250 [ 31 (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", 32 (testprotos.exfubar) = "splat!" 33 ]; 34 35 reserved 10 to 20, 30 to 50; 36 37 reserved "foo", "bar", "baz"; 38 39 // Group comment with emoji 😀 😍 👻 ❤ 💯 💥 🐶 🦂 🥑 🍻 🌍 🚕 🪐 40 optional group Extras = 3 { 41 option (testprotos.mfubar) = false; 42 43 optional double dbl = 1; 44 45 optional float flt = 2; 46 47 option no_standard_descriptor_accessor = false; 48 49 // Leading comment... 50 optional string str = 3; 51 } 52 53 enum MarioCharacters { 54 option allow_alias = true; 55 56 MARIO = 1 [ 57 (testprotos.evfubars) = -314, 58 (testprotos.evfubar) = 278 59 ]; 60 61 LUIGI = 2 [ 62 (testprotos.evfubaruf) = 100, 63 (testprotos.evfubaru) = 200 64 ]; 65 66 PEACH = 3; 67 68 BOWSER = 4; 69 70 option (testprotos.efubars) = -321; 71 72 WARIO = 5; 73 74 WALUIGI = 6; 75 76 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 77 78 HEY_HO = 7; 79 80 MAGIKOOPA = 8; 81 82 KAMEK = 8; 83 84 SNIFIT = -101; 85 86 option (testprotos.efubar) = 123; 87 } 88 89 // can be this or that 90 oneof abc { 91 string this = 4; 92 93 int32 that = 5; 94 } 95 96 // can be these or those 97 oneof xyz { 98 option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377"; 99 100 string these = 6; 101 102 int32 those = 7; 103 } 104 105 // map field 106 map<string, string> things = 8; 107 } 108 109 extend Request { 110 // comment for guid1 111 optional uint64 guid1 = 123; 112 113 // ... and a comment for guid2 114 optional uint64 guid2 = 124; 115 } 116 117 message AnEmptyMessage { 118 } 119 120 // Service comment 121 service RpcService { 122 option (testprotos.sfubar) = { id: 100, name: "bob" }; 123 124 option deprecated = false; 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 }