1syntax = "proto2";
2
3package basic_test_proto2;
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  optional Bar bar = 1;
12  repeated Baz baz = 2;
13}
14
15message Bar {
16  optional string msg = 1;
17}
18
19message Baz {
20  optional 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 TestMessage2 {
50  optional int32 foo = 1;
51}
52
53message TestMessageDefaults {
54  optional int32 optional_int32 = 1 [default = 1];
55  optional int64 optional_int64 = 2 [default = 2];
56  optional uint32 optional_uint32 = 3 [default = 3];
57  optional uint64 optional_uint64 = 4 [default = 4];
58  optional bool optional_bool = 5 [default = true];
59  optional float optional_float = 6 [default = 6];
60  optional double optional_double = 7 [default = 7];
61  optional string optional_string = 8 [default = "Default Str"];
62  optional bytes optional_bytes = 9 [default = "\xCF\xA5s\xBD\xBA\xE6fubar"];
63  optional TestMessage2 optional_msg = 10;
64  optional TestNonZeroEnum optional_enum = 11 [default = B2];
65}
66
67enum TestEnum {
68  Default = 0;
69  A = 1;
70  B = 2;
71  C = 3;
72}
73
74enum TestNonZeroEnum {
75  A2 = 1;
76  B2 = 2;
77  C2 = 3;
78}
79
80message TestEmbeddedMessageParent {
81  optional TestEmbeddedMessageChild child_msg = 1;
82  optional int32 number = 2;
83
84  repeated TestEmbeddedMessageChild repeated_msg = 3;
85  repeated int32 repeated_number = 4;
86}
87
88message TestEmbeddedMessageChild {
89  optional TestMessage sub_child = 1;
90}
91
92message Recursive1 {
93  optional Recursive2 foo = 1;
94}
95
96message Recursive2 {
97  optional Recursive1 foo = 1;
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  optional string key = 1;
107  optional int32 value = 2;
108}
109
110message MapMessageWireEquiv_entry2 {
111  optional string key = 1;
112  optional 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 Wrapper {
125  optional google.protobuf.DoubleValue double = 1;
126  optional google.protobuf.FloatValue float = 2;
127  optional google.protobuf.Int32Value int32 = 3;
128  optional google.protobuf.Int64Value int64 = 4;
129  optional google.protobuf.UInt32Value uint32 = 5;
130  optional google.protobuf.UInt64Value uint64 = 6;
131  optional google.protobuf.BoolValue bool = 7;
132  optional google.protobuf.StringValue string = 8;
133  optional google.protobuf.BytesValue bytes = 9;
134  optional string real_string = 100;
135  oneof a_oneof {
136    string oneof_string = 10;
137  }
138}
139
140message TimeMessage {
141  optional google.protobuf.Timestamp timestamp = 1;
142  optional google.protobuf.Duration duration = 2;
143}
144
145message Enumer {
146  optional TestEnum optional_enum = 11;
147  repeated TestEnum repeated_enum = 22;
148  optional string a_const = 3;
149  oneof a_oneof {
150    string str = 100;
151    TestEnum const = 101;
152  }
153}
154
155message MyRepeatedStruct {
156  repeated MyStruct structs = 1;
157}
158
159message MyStruct {
160  optional string string = 1;
161  optional google.protobuf.Struct struct = 2;
162}
163