• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto3";
2
3package basic_test;
4
5import "google/protobuf/wrappers.proto";
6import "google/protobuf/timestamp.proto";
7import "google/protobuf/duration.proto";
8import "google/protobuf/struct.proto";
9
10message Foo {
11  Bar bar = 1;
12  repeated Baz baz = 2;
13}
14
15message Bar {
16  string msg = 1;
17}
18
19message Baz {
20  string msg = 1;
21}
22
23message TestMessage {
24  optional int32 optional_int32 = 1;
25  optional int64 optional_int64 = 2;
26  optional uint32 optional_uint32 = 3;
27  optional uint64 optional_uint64 = 4;
28  optional bool optional_bool = 5;
29  optional float optional_float = 6;
30  optional double optional_double = 7;
31  optional string optional_string = 8;
32  optional bytes optional_bytes = 9;
33  optional TestMessage2 optional_msg = 10;
34  optional TestEnum optional_enum = 11;
35
36  repeated int32 repeated_int32 = 12;
37  repeated int64 repeated_int64 = 13;
38  repeated uint32 repeated_uint32 = 14;
39  repeated uint64 repeated_uint64 = 15;
40  repeated bool repeated_bool = 16;
41  repeated float repeated_float = 17;
42  repeated double repeated_double = 18;
43  repeated string repeated_string = 19;
44  repeated bytes repeated_bytes = 20;
45  repeated TestMessage2 repeated_msg = 21;
46  repeated TestEnum repeated_enum = 22;
47}
48
49message TestSingularFields {
50  int32 singular_int32 = 1;
51  int64 singular_int64 = 2;
52  uint32 singular_uint32 = 3;
53  uint64 singular_uint64 = 4;
54  bool singular_bool = 5;
55  float singular_float = 6;
56  double singular_double = 7;
57  string singular_string = 8;
58  bytes singular_bytes = 9;
59  TestMessage2 singular_msg = 10;
60  TestEnum singular_enum = 11;
61}
62
63message TestMessage2 {
64  int32 foo = 1;
65}
66
67enum TestEnum {
68  Default = 0;
69  A = 1;
70  B = 2;
71  C = 3;
72}
73
74message TestEmbeddedMessageParent {
75  TestEmbeddedMessageChild child_msg = 1;
76  int32 number = 2;
77
78  repeated TestEmbeddedMessageChild repeated_msg = 3;
79  repeated int32 repeated_number = 4;
80}
81
82message TestEmbeddedMessageChild {
83  TestMessage sub_child = 1;
84}
85
86message Recursive1 {
87  Recursive2 foo = 1;
88}
89
90message Recursive2 {
91  Recursive1 foo = 1;
92}
93
94message MapMessage {
95  map<string, int32> map_string_int32 = 1;
96  map<string, TestMessage2> map_string_msg = 2;
97  map<string, TestEnum> map_string_enum = 3;
98}
99
100message MapMessageWireEquiv {
101  repeated MapMessageWireEquiv_entry1 map_string_int32 = 1;
102  repeated MapMessageWireEquiv_entry2 map_string_msg = 2;
103}
104
105message MapMessageWireEquiv_entry1 {
106  string key = 1;
107  int32 value = 2;
108}
109
110message MapMessageWireEquiv_entry2 {
111  string key = 1;
112  TestMessage2 value = 2;
113}
114
115message OneofMessage {
116  oneof my_oneof {
117    string a = 1;
118    int32 b = 2;
119    TestMessage2 c = 3;
120    TestEnum d = 4;
121  }
122}
123
124message Outer {
125  map<int32, Inner> items = 1;
126}
127
128message Inner {
129}
130
131message Wrapper {
132  google.protobuf.DoubleValue double = 1;
133  google.protobuf.FloatValue float = 2;
134  google.protobuf.Int32Value int32 = 3;
135  google.protobuf.Int64Value int64 = 4;
136  google.protobuf.UInt32Value uint32 = 5;
137  google.protobuf.UInt64Value uint64 = 6;
138  google.protobuf.BoolValue bool = 7;
139  google.protobuf.StringValue string = 8;
140  google.protobuf.BytesValue bytes = 9;
141  string real_string = 100;
142  oneof a_oneof {
143    string string_in_oneof = 10;
144  }
145
146  // Repeated wrappers don't make sense, but we still need to make sure they
147  // work and don't crash.
148  repeated google.protobuf.DoubleValue repeated_double = 11;
149  repeated google.protobuf.FloatValue repeated_float = 12;
150  repeated google.protobuf.Int32Value repeated_int32 = 13;
151  repeated google.protobuf.Int64Value repeated_int64 = 14;
152  repeated google.protobuf.UInt32Value repeated_uint32 = 15;
153  repeated google.protobuf.UInt64Value repeated_uint64 = 16;
154  repeated google.protobuf.BoolValue repeated_bool = 17;
155  repeated google.protobuf.StringValue repeated_string = 18;
156  repeated google.protobuf.BytesValue repeated_bytes = 19;
157
158  // Wrappers as map keys don't make sense, but we still need to make sure they
159  // work and don't crash.
160  map<int32, google.protobuf.DoubleValue> map_double = 21;
161  map<int32, google.protobuf.FloatValue> map_float = 22;
162  map<int32, google.protobuf.Int32Value> map_int32 = 23;
163  map<int32, google.protobuf.Int64Value> map_int64 = 24;
164  map<int32, google.protobuf.UInt32Value> map_uint32 = 25;
165  map<int32, google.protobuf.UInt64Value> map_uint64 = 26;
166  map<int32, google.protobuf.BoolValue> map_bool = 27;
167  map<int32, google.protobuf.StringValue> map_string = 28;
168  map<int32, google.protobuf.BytesValue> map_bytes = 29;
169
170  // Wrappers in oneofs don't make sense, but we still need to make sure they
171  // work and don't crash.
172  oneof wrapper_oneof {
173    google.protobuf.DoubleValue oneof_double = 31;
174    google.protobuf.FloatValue oneof_float = 32;
175    google.protobuf.Int32Value oneof_int32 = 33;
176    google.protobuf.Int64Value oneof_int64 = 34;
177    google.protobuf.UInt32Value oneof_uint32 = 35;
178    google.protobuf.UInt64Value oneof_uint64 = 36;
179    google.protobuf.BoolValue oneof_bool = 37;
180    google.protobuf.StringValue oneof_string = 38;
181    google.protobuf.BytesValue oneof_bytes = 39;
182    string oneof_plain_string = 101;
183  }
184}
185
186message TimeMessage {
187  google.protobuf.Timestamp timestamp = 1;
188  google.protobuf.Duration duration = 2;
189}
190
191message Enumer {
192  TestEnum optional_enum = 1;
193  repeated TestEnum repeated_enum = 2;
194  string a_const = 3;
195  oneof a_oneof {
196    string str = 10;
197    TestEnum const = 11;
198  }
199}
200
201message MyRepeatedStruct {
202  repeated MyStruct structs = 1;
203}
204
205message MyStruct {
206  string string = 1;
207  google.protobuf.Struct struct = 2;
208}
209