github.com/nikron/prototool@v1.3.0/internal/cmd/testdata/format/proto3/foo/foo.proto (about) 1 // foo 2 3 // bar 4 5 syntax = "proto3"; // inline comment1 6 7 // baz 8 9 package foo; // inline comment3 10 11 // bat 12 // ban 13 14 // comment9 15 import "google/protobuf/timestamp.proto"; // inline comment9 16 //comment10 17 import "foo/bar/bar.proto"; //inline comment10 18 19 20 21 // comment11 22 option java_multiple_files = true; //inline comment11 23 // comment12 24 option java_package = "com.foo"; // inline comment23 25 // comment4 26 option go_package = "foopb"; // inline comment4 27 // comment5 28 option java_outer_classname = "FooProto"; // inline comment5 29 // comment6 30 option (bar.file_option) = true; // inline comment6 31 // comment16 32 option (bar.file_dep_option) = { 33 hello: 1 34 recursive: {} 35 bar: 2 36 }; // inline comment16 37 38 // Baz is a baz. 39 message Baz { 40 // comment14 41 // still comment14 42 option (bar.message_option) = true; // inline comment14 43 // comment15 44 option (bar.message_dep_option) = { hello: 1 };// inline comment15 45 46 int64 hello = 1; 47 48 // unassociated comment 49 50 // another unassociated comment 51 52 // dep comment 53 bar.Dep dep = 2; 54 google.protobuf.Timestamp timestamp = 3; /* inline c-style comment */ 55 56 int64 woot = 5 [ (bar.field_option) = true]; 57 // comment17 58 int64 woot2 = 6 [ 59 (bar.field_option) = true, 60 (bar.field_dep_option) = { hello: 1} 61 ] 62 ; // inline comment17 63 64 map<string, int64> m = 11; 65 map<string, int64> m2 = 12 [ 66 (bar.field_option) = true, 67 (bar.field_dep_option) = { hello: 1} 68 ]; 69 70 oneof test_oneof { 71 // TODO: readd when oneof options handled 72 option (bar.oneof_option) = true ; // inline comment18 73 option (bar.oneof_dep_option) = { 74 hello: 1 };// inline comment19 75 int64 foo1 = 8; 76 string foo2 = 9; 77 // comment18 78 int64 woot3 = 10 [ 79 (bar.field_option) = true, 80 (bar.field_dep_option) = { hello: 1} 81 ]; // inline comment18 82 // comment21 83 bar.Dep dep2 = 14; // inline comment21 84 } 85 86 int64 test_repeated_field_option = 15 [ 87 (bar.repeated_field_option) = 1, 88 (bar.repeated_field_option) = 2 89 ]; 90 int64 test_repeated_dep_option = 16 [ 91 (bar.field_dep_option) = { hello: 1, repeated_bar: [1, 2] }, 92 (bar.repeated_field_dep_option) = { hello: 1, recursive: { hello: 2, repeated_bar: [3, 4] } }, 93 (bar.repeated_field_dep_option) = { hello: 5, recursive: { hello: 6, repeated_bar: [7, 8] } }, 94 (bar.repeated_field_dep_option) = { hello: 1, repeated_dep: [ 95 { hello: 1, repeated_bar: [1, 2] }, 96 { hello: 3, repeated_bar: [3, 4] } ] } 97 ]; 98 } 99 100 // Bat is a bat. 101 message Bat { 102 reserved 2 to 10, 1000 to 1100; 103 reserved "foo"; 104 reserved "bar", "baz"; 105 // NestedBat is a nested bat. 106 message NestedBat { 107 int64 hello = 1; 108 } 109 } 110 111 enum SomeAlias { 112 option allow_alias = true; 113 SOME_ALIAS_INVALID = 0; 114 SOME_ALIAS_UNSET = 1; 115 SOME_ALIAS_TREE = 2; 116 SOME_ALIAS_BALLOON = 3; 117 SOME_ALIAS_LAMP_POST = 3; 118 } 119 120 // Empty is an empty message. 121 message Empty { 122 } 123 124 // Something is something. 125 enum Something { 126 option (bar.enum_option) = true; 127 // comment25 128 SOMETHING_INVALID = 0 [ 129 (bar.enum_value_option) = true 130 ]; // inline comment25 131 // comment27 132 SOMETHING_UNSET = 1; // inline comment27 133 // comment28 134 SOMETHING_FOO = 2; // inline comment28 135 } 136 137 // Daylight is the daylight service. 138 service Daylight { 139 option (bar.service_option) = true ; // inline comment29 140 option (bar.service_dep_option) = { 141 hello: 1 };// inline comment30 142 rpc Hello(Bat) returns (Empty) { 143 //option (bar.method_option) = true; 144 option (bar.method_dep_option) = { hello: 1, bar: 2, recursive: { hello: 3, recursive: { bar: 2 } } }; // inline comment22 145 } // inline comment23 146 rpc Foo(Empty) returns (Bat); // inline comment24 147 }