protobufjs 5.0.1 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.travis.yml +2 -1
  2. package/README.md +144 -22
  3. package/bin/pbjs +2 -2
  4. package/bower.json +2 -2
  5. package/cli/pbjs/targets/amd.js +1 -1
  6. package/cli/pbjs/targets/json.js +8 -0
  7. package/cli/pbjs/util.js +1 -1
  8. package/cli/pbjs.js +1 -1
  9. package/dist/protobuf-light.js +166 -128
  10. package/dist/protobuf-light.min.js +88 -81
  11. package/dist/protobuf-light.min.js.gz +0 -0
  12. package/dist/protobuf-light.min.map +4 -4
  13. package/dist/protobuf.js +171 -129
  14. package/dist/protobuf.min.js +106 -98
  15. package/dist/protobuf.min.js.gz +0 -0
  16. package/dist/protobuf.min.map +4 -4
  17. package/docs/ProtoBuf.Builder.Message.html +1408 -971
  18. package/docs/ProtoBuf.Builder.Service.html +266 -197
  19. package/docs/ProtoBuf.Builder.html +758 -542
  20. package/docs/ProtoBuf.DotProto.Parser.html +223 -161
  21. package/docs/ProtoBuf.DotProto.Tokenizer.html +344 -248
  22. package/docs/ProtoBuf.DotProto.html +20 -12
  23. package/docs/ProtoBuf.Element.html +554 -554
  24. package/docs/ProtoBuf.Map.html +158 -123
  25. package/docs/ProtoBuf.Reflect.Element.html +286 -143
  26. package/docs/ProtoBuf.Reflect.Enum.Value.html +329 -228
  27. package/docs/ProtoBuf.Reflect.Enum.html +757 -537
  28. package/docs/ProtoBuf.Reflect.Extension.html +73 -56
  29. package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +1013 -740
  30. package/docs/ProtoBuf.Reflect.Message.Field.html +926 -649
  31. package/docs/ProtoBuf.Reflect.Message.OneOf.html +327 -245
  32. package/docs/ProtoBuf.Reflect.Message.html +915 -651
  33. package/docs/ProtoBuf.Reflect.Namespace.html +648 -447
  34. package/docs/ProtoBuf.Reflect.Service.Method.html +363 -251
  35. package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +545 -397
  36. package/docs/ProtoBuf.Reflect.Service.html +721 -511
  37. package/docs/ProtoBuf.Reflect.T.html +268 -197
  38. package/docs/ProtoBuf.Reflect.html +20 -12
  39. package/docs/ProtoBuf.Util.html +169 -118
  40. package/docs/ProtoBuf.html +840 -628
  41. package/docs/ProtoBuf.js.html +177 -134
  42. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  43. package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
  44. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  45. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  46. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  47. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  48. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  49. package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
  50. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  51. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  52. package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
  53. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  54. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  55. package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  56. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  57. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  58. package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
  59. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  60. package/docs/index.html +7 -5
  61. package/docs/styles/jsdoc-default.css +95 -75
  62. package/docs/styles/prettify-tomorrow.css +1 -1
  63. package/examples/protoify/json.js +123 -123
  64. package/examples/protoify/json.json +123 -123
  65. package/examples/websocket/server.js +4 -4
  66. package/externs/protobuf.js +1 -1
  67. package/jsdoc.json +1 -1
  68. package/package.json +2 -2
  69. package/scripts/build.js +53 -53
  70. package/src/ProtoBuf/Builder/Message.js +9 -5
  71. package/src/ProtoBuf/Builder.js +19 -2
  72. package/src/ProtoBuf/DotProto/Parser.js +5 -1
  73. package/src/ProtoBuf/Reflect/Element.js +13 -1
  74. package/src/ProtoBuf/Reflect/Message/Field.js +2 -2
  75. package/src/ProtoBuf/Reflect/Message.js +6 -1
  76. package/src/ProtoBuf/Util.js +116 -116
  77. package/src/bower.json +1 -1
  78. package/src/google/protobuf/descriptor.json +27 -1
  79. package/tests/bench.txt +373 -373
  80. package/tests/complex.json +8 -1
  81. package/tests/custom-options.json +169 -169
  82. package/tests/extend.json +71 -71
  83. package/tests/imports.json +83 -83
  84. package/tests/nodeunit-browser/nodeunit.css +70 -70
  85. package/tests/nodeunit-browser/nodeunit.js +2108 -2108
  86. package/tests/options.json +32 -32
  87. package/tests/proto2js/Bar.json +46 -46
  88. package/tests/suite.js +43 -1
  89. package/sandbox/gapi/googleapis/google/api/annotations.proto +0 -29
  90. package/sandbox/gapi/googleapis/google/api/http.proto +0 -245
  91. package/sandbox/gapi/googleapis/google/datastore/v1beta3/datastore.proto +0 -281
  92. package/sandbox/gapi/googleapis/google/datastore/v1beta3/entity.proto +0 -189
  93. package/sandbox/gapi/googleapis/google/datastore/v1beta3/query.proto +0 -281
  94. package/sandbox/gapi/googleapis/google/longrunning/operations.proto +0 -144
  95. package/sandbox/gapi/googleapis/google/protobuf/any.proto +0 -98
  96. package/sandbox/gapi/googleapis/google/protobuf/any_test.proto +0 -41
  97. package/sandbox/gapi/googleapis/google/protobuf/api.proto +0 -201
  98. package/sandbox/gapi/googleapis/google/protobuf/descriptor.proto +0 -773
  99. package/sandbox/gapi/googleapis/google/protobuf/duration.proto +0 -95
  100. package/sandbox/gapi/googleapis/google/protobuf/empty.proto +0 -50
  101. package/sandbox/gapi/googleapis/google/protobuf/field_mask.proto +0 -167
  102. package/sandbox/gapi/googleapis/google/protobuf/map_lite_unittest.proto +0 -130
  103. package/sandbox/gapi/googleapis/google/protobuf/map_proto2_unittest.proto +0 -60
  104. package/sandbox/gapi/googleapis/google/protobuf/map_unittest.proto +0 -129
  105. package/sandbox/gapi/googleapis/google/protobuf/map_unittest_proto3.proto +0 -120
  106. package/sandbox/gapi/googleapis/google/protobuf/source_context.proto +0 -47
  107. package/sandbox/gapi/googleapis/google/protobuf/struct.proto +0 -94
  108. package/sandbox/gapi/googleapis/google/protobuf/timestamp.proto +0 -107
  109. package/sandbox/gapi/googleapis/google/protobuf/type.proto +0 -176
  110. package/sandbox/gapi/googleapis/google/protobuf/unittest.proto +0 -878
  111. package/sandbox/gapi/googleapis/google/protobuf/unittest_arena.proto +0 -46
  112. package/sandbox/gapi/googleapis/google/protobuf/unittest_custom_options.proto +0 -394
  113. package/sandbox/gapi/googleapis/google/protobuf/unittest_drop_unknown_fields.proto +0 -58
  114. package/sandbox/gapi/googleapis/google/protobuf/unittest_embed_optimize_for.proto +0 -51
  115. package/sandbox/gapi/googleapis/google/protobuf/unittest_empty.proto +0 -38
  116. package/sandbox/gapi/googleapis/google/protobuf/unittest_enormous_descriptor.proto +0 -1048
  117. package/sandbox/gapi/googleapis/google/protobuf/unittest_import.proto +0 -66
  118. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_lite.proto +0 -52
  119. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_proto3.proto +0 -68
  120. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public.proto +0 -41
  121. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_lite.proto +0 -43
  122. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_proto3.proto +0 -42
  123. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite.proto +0 -385
  124. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite_imports_nonlite.proto +0 -44
  125. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset.proto +0 -82
  126. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset_wire_format.proto +0 -52
  127. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena.proto +0 -202
  128. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_import.proto +0 -37
  129. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_lite.proto +0 -42
  130. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_field_presence.proto +0 -138
  131. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_generic_services.proto +0 -54
  132. package/sandbox/gapi/googleapis/google/protobuf/unittest_optimize_for.proto +0 -67
  133. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum.proto +0 -71
  134. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum2.proto +0 -50
  135. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3.proto +0 -388
  136. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3_arena.proto +0 -206
  137. package/sandbox/gapi/googleapis/google/protobuf/unittest_well_known_types.proto +0 -112
  138. package/sandbox/gapi/googleapis/google/protobuf/unknown_enum_test.proto +0 -62
  139. package/sandbox/gapi/googleapis/google/protobuf/wrappers.proto +0 -117
  140. package/sandbox/gapi/googleapis/google/rpc/code.proto +0 -190
  141. package/sandbox/gapi/googleapis/google/rpc/error_details.proto +0 -157
  142. package/sandbox/gapi/googleapis/google/rpc/status.proto +0 -90
  143. package/sandbox/gapi/googleapis/google/type/color.proto +0 -163
  144. package/sandbox/gapi/googleapis/google/type/date.proto +0 -43
  145. package/sandbox/gapi/googleapis/google/type/dayofweek.proto +0 -50
  146. package/sandbox/gapi/googleapis/google/type/latlng.proto +0 -36
  147. package/sandbox/gapi/googleapis/google/type/money.proto +0 -40
  148. package/sandbox/gapi/googleapis/google/type/timeofday.proto +0 -42
  149. package/sandbox/gapi/test.js +0 -17
  150. package/sandbox/gapi/test.proto +0 -12
  151. package/sandbox/issue146/MyOptions.proto +0 -28
  152. package/sandbox/issue146/Sample.proto +0 -21
  153. package/sandbox/issue146/main.js +0 -3
  154. package/sandbox/issue147/enum.proto +0 -8
  155. package/sandbox/issue147/main.js +0 -3
  156. package/sandbox/issue182/commands.proto +0 -10
  157. package/sandbox/issue182/execute.js +0 -22
  158. package/sandbox/issue182/session_commands.proto +0 -14
  159. package/sandbox/issue289/A.proto +0 -8
  160. package/sandbox/issue289/B.proto +0 -8
  161. package/sandbox/issue289/common.proto +0 -5
  162. package/sandbox/issue289/main.js +0 -7
  163. package/sandbox/issue300/IAuth.proto +0 -14
  164. package/sandbox/issue300/Request.proto +0 -14
  165. package/sandbox/issue300/main.js +0 -26
  166. package/sandbox/issue347/index.js +0 -27
  167. package/sandbox/issue355/main.proto +0 -15
  168. package/sandbox/issue42/innerextend.proto +0 -18
  169. package/sandbox/issue42/main.js +0 -8
  170. package/sandbox/issue42/outerextend.proto +0 -17
@@ -1,388 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- // Author: kenton@google.com (Kenton Varda)
32
- // Based on original Protocol Buffers design by
33
- // Sanjay Ghemawat, Jeff Dean, and others.
34
- //
35
- // A proto file we will use for unit testing.
36
-
37
- syntax = "proto3";
38
-
39
- // Some generic_services option(s) added automatically.
40
- // See: http://go/proto2-generic-services-default
41
- option cc_generic_services = true; // auto-added
42
- option java_generic_services = true; // auto-added
43
- option py_generic_services = true; // auto-added
44
- option cc_enable_arenas = true;
45
- option csharp_namespace = "Google.Protobuf.TestProtos";
46
-
47
- import "google/protobuf/unittest_import_proto3.proto";
48
-
49
- // We don't put this in a package within proto2 because we need to make sure
50
- // that the generated code doesn't depend on being in the proto2 namespace.
51
- // In test_util.h we do "using namespace unittest = protobuf_unittest".
52
- package protobuf_unittest;
53
-
54
- // Protos optimized for SPEED use a strict superset of the generated code
55
- // of equivalent ones optimized for CODE_SIZE, so we should optimize all our
56
- // tests for speed unless explicitly testing code size optimization.
57
- option optimize_for = SPEED;
58
-
59
- option java_outer_classname = "UnittestProto";
60
-
61
- // This proto includes every type of field in both singular and repeated
62
- // forms.
63
- message TestAllTypes {
64
- message NestedMessage {
65
- // The field name "b" fails to compile in proto1 because it conflicts with
66
- // a local variable named "b" in one of the generated methods. Doh.
67
- // This file needs to compile in proto1 to test backwards-compatibility.
68
- int32 bb = 1;
69
- }
70
-
71
- enum NestedEnum {
72
- NESTED_ENUM_UNSPECIFIED = 0;
73
- FOO = 1;
74
- BAR = 2;
75
- BAZ = 3;
76
- NEG = -1; // Intentionally negative.
77
- }
78
-
79
- // Singular
80
- int32 single_int32 = 1;
81
- int64 single_int64 = 2;
82
- uint32 single_uint32 = 3;
83
- uint64 single_uint64 = 4;
84
- sint32 single_sint32 = 5;
85
- sint64 single_sint64 = 6;
86
- fixed32 single_fixed32 = 7;
87
- fixed64 single_fixed64 = 8;
88
- sfixed32 single_sfixed32 = 9;
89
- sfixed64 single_sfixed64 = 10;
90
- float single_float = 11;
91
- double single_double = 12;
92
- bool single_bool = 13;
93
- string single_string = 14;
94
- bytes single_bytes = 15;
95
-
96
- NestedMessage single_nested_message = 18;
97
- ForeignMessage single_foreign_message = 19;
98
- protobuf_unittest_import.ImportMessage single_import_message = 20;
99
-
100
- NestedEnum single_nested_enum = 21;
101
- ForeignEnum single_foreign_enum = 22;
102
- protobuf_unittest_import.ImportEnum single_import_enum = 23;
103
-
104
- // Defined in unittest_import_public.proto
105
- protobuf_unittest_import.PublicImportMessage
106
- single_public_import_message = 26;
107
-
108
- // Repeated
109
- repeated int32 repeated_int32 = 31;
110
- repeated int64 repeated_int64 = 32;
111
- repeated uint32 repeated_uint32 = 33;
112
- repeated uint64 repeated_uint64 = 34;
113
- repeated sint32 repeated_sint32 = 35;
114
- repeated sint64 repeated_sint64 = 36;
115
- repeated fixed32 repeated_fixed32 = 37;
116
- repeated fixed64 repeated_fixed64 = 38;
117
- repeated sfixed32 repeated_sfixed32 = 39;
118
- repeated sfixed64 repeated_sfixed64 = 40;
119
- repeated float repeated_float = 41;
120
- repeated double repeated_double = 42;
121
- repeated bool repeated_bool = 43;
122
- repeated string repeated_string = 44;
123
- repeated bytes repeated_bytes = 45;
124
-
125
- repeated NestedMessage repeated_nested_message = 48;
126
- repeated ForeignMessage repeated_foreign_message = 49;
127
- repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50;
128
-
129
- repeated NestedEnum repeated_nested_enum = 51;
130
- repeated ForeignEnum repeated_foreign_enum = 52;
131
- repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53;
132
- // Defined in unittest_import_public.proto
133
- repeated protobuf_unittest_import.PublicImportMessage
134
- repeated_public_import_message = 54;
135
-
136
- // For oneof test
137
- oneof oneof_field {
138
- uint32 oneof_uint32 = 111;
139
- NestedMessage oneof_nested_message = 112;
140
- string oneof_string = 113;
141
- bytes oneof_bytes = 114;
142
- }
143
- }
144
-
145
- // This proto includes a recusively nested message.
146
- message NestedTestAllTypes {
147
- NestedTestAllTypes child = 1;
148
- TestAllTypes payload = 2;
149
- repeated NestedTestAllTypes repeated_child = 3;
150
- }
151
-
152
- message TestDeprecatedFields {
153
- int32 deprecated_int32 = 1 [deprecated=true];
154
- }
155
-
156
- // Define these after TestAllTypes to make sure the compiler can handle
157
- // that.
158
- message ForeignMessage {
159
- int32 c = 1;
160
- }
161
-
162
- enum ForeignEnum {
163
- FOREIGN_UNSPECIFIED = 0;
164
- FOREIGN_FOO = 4;
165
- FOREIGN_BAR = 5;
166
- FOREIGN_BAZ = 6;
167
- }
168
-
169
- message TestReservedFields {
170
- reserved 2, 15, 9 to 11;
171
- reserved "bar", "baz";
172
- }
173
-
174
-
175
- // Test that we can use NestedMessage from outside TestAllTypes.
176
- message TestForeignNested {
177
- TestAllTypes.NestedMessage foreign_nested = 1;
178
- }
179
-
180
- // Test that really large tag numbers don't break anything.
181
- message TestReallyLargeTagNumber {
182
- // The largest possible tag number is 2^28 - 1, since the wire format uses
183
- // three bits to communicate wire type.
184
- int32 a = 1;
185
- int32 bb = 268435455;
186
- }
187
-
188
- message TestRecursiveMessage {
189
- TestRecursiveMessage a = 1;
190
- int32 i = 2;
191
- }
192
-
193
- // Test that mutual recursion works.
194
- message TestMutualRecursionA {
195
- TestMutualRecursionB bb = 1;
196
- }
197
-
198
- message TestMutualRecursionB {
199
- TestMutualRecursionA a = 1;
200
- int32 optional_int32 = 2;
201
- }
202
-
203
-
204
- // Test an enum that has multiple values with the same number.
205
- enum TestEnumWithDupValue {
206
- TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0;
207
- option allow_alias = true;
208
-
209
- FOO1 = 1;
210
- BAR1 = 2;
211
- BAZ = 3;
212
- FOO2 = 1;
213
- BAR2 = 2;
214
- }
215
-
216
- // Test an enum with large, unordered values.
217
- enum TestSparseEnum {
218
- TEST_SPARSE_ENUM_UNSPECIFIED = 0;
219
- SPARSE_A = 123;
220
- SPARSE_B = 62374;
221
- SPARSE_C = 12589234;
222
- SPARSE_D = -15;
223
- SPARSE_E = -53452;
224
- // In proto3, value 0 must be the first one specified
225
- // SPARSE_F = 0;
226
- SPARSE_G = 2;
227
- }
228
-
229
- // Test message with CamelCase field names. This violates Protocol Buffer
230
- // standard style.
231
- message TestCamelCaseFieldNames {
232
- int32 PrimitiveField = 1;
233
- string StringField = 2;
234
- ForeignEnum EnumField = 3;
235
- ForeignMessage MessageField = 4;
236
-
237
- repeated int32 RepeatedPrimitiveField = 7;
238
- repeated string RepeatedStringField = 8;
239
- repeated ForeignEnum RepeatedEnumField = 9;
240
- repeated ForeignMessage RepeatedMessageField = 10;
241
- }
242
-
243
-
244
- // We list fields out of order, to ensure that we're using field number and not
245
- // field index to determine serialization order.
246
- message TestFieldOrderings {
247
- string my_string = 11;
248
- int64 my_int = 1;
249
- float my_float = 101;
250
- message NestedMessage {
251
- int64 oo = 2;
252
- // The field name "b" fails to compile in proto1 because it conflicts with
253
- // a local variable named "b" in one of the generated methods. Doh.
254
- // This file needs to compile in proto1 to test backwards-compatibility.
255
- int32 bb = 1;
256
- }
257
-
258
- NestedMessage single_nested_message = 200;
259
- }
260
-
261
- message SparseEnumMessage {
262
- TestSparseEnum sparse_enum = 1;
263
- }
264
-
265
- // Test String and Bytes: string is for valid UTF-8 strings
266
- message OneString {
267
- string data = 1;
268
- }
269
-
270
- message MoreString {
271
- repeated string data = 1;
272
- }
273
-
274
- message OneBytes {
275
- bytes data = 1;
276
- }
277
-
278
- message MoreBytes {
279
- bytes data = 1;
280
- }
281
-
282
- // Test int32, uint32, int64, uint64, and bool are all compatible
283
- message Int32Message {
284
- int32 data = 1;
285
- }
286
-
287
- message Uint32Message {
288
- uint32 data = 1;
289
- }
290
-
291
- message Int64Message {
292
- int64 data = 1;
293
- }
294
-
295
- message Uint64Message {
296
- uint64 data = 1;
297
- }
298
-
299
- message BoolMessage {
300
- bool data = 1;
301
- }
302
-
303
- // Test oneofs.
304
- message TestOneof {
305
- oneof foo {
306
- int32 foo_int = 1;
307
- string foo_string = 2;
308
- TestAllTypes foo_message = 3;
309
- }
310
- }
311
-
312
- // Test messages for packed fields
313
-
314
- message TestPackedTypes {
315
- repeated int32 packed_int32 = 90 [packed = true];
316
- repeated int64 packed_int64 = 91 [packed = true];
317
- repeated uint32 packed_uint32 = 92 [packed = true];
318
- repeated uint64 packed_uint64 = 93 [packed = true];
319
- repeated sint32 packed_sint32 = 94 [packed = true];
320
- repeated sint64 packed_sint64 = 95 [packed = true];
321
- repeated fixed32 packed_fixed32 = 96 [packed = true];
322
- repeated fixed64 packed_fixed64 = 97 [packed = true];
323
- repeated sfixed32 packed_sfixed32 = 98 [packed = true];
324
- repeated sfixed64 packed_sfixed64 = 99 [packed = true];
325
- repeated float packed_float = 100 [packed = true];
326
- repeated double packed_double = 101 [packed = true];
327
- repeated bool packed_bool = 102 [packed = true];
328
- repeated ForeignEnum packed_enum = 103 [packed = true];
329
- }
330
-
331
- // A message with the same fields as TestPackedTypes, but without packing. Used
332
- // to test packed <-> unpacked wire compatibility.
333
- message TestUnpackedTypes {
334
- repeated int32 unpacked_int32 = 90 [packed = false];
335
- repeated int64 unpacked_int64 = 91 [packed = false];
336
- repeated uint32 unpacked_uint32 = 92 [packed = false];
337
- repeated uint64 unpacked_uint64 = 93 [packed = false];
338
- repeated sint32 unpacked_sint32 = 94 [packed = false];
339
- repeated sint64 unpacked_sint64 = 95 [packed = false];
340
- repeated fixed32 unpacked_fixed32 = 96 [packed = false];
341
- repeated fixed64 unpacked_fixed64 = 97 [packed = false];
342
- repeated sfixed32 unpacked_sfixed32 = 98 [packed = false];
343
- repeated sfixed64 unpacked_sfixed64 = 99 [packed = false];
344
- repeated float unpacked_float = 100 [packed = false];
345
- repeated double unpacked_double = 101 [packed = false];
346
- repeated bool unpacked_bool = 102 [packed = false];
347
- repeated ForeignEnum unpacked_enum = 103 [packed = false];
348
- }
349
-
350
- message TestRepeatedScalarDifferentTagSizes {
351
- // Parsing repeated fixed size values used to fail. This message needs to be
352
- // used in order to get a tag of the right size; all of the repeated fields
353
- // in TestAllTypes didn't trigger the check.
354
- repeated fixed32 repeated_fixed32 = 12;
355
- // Check for a varint type, just for good measure.
356
- repeated int32 repeated_int32 = 13;
357
-
358
- // These have two-byte tags.
359
- repeated fixed64 repeated_fixed64 = 2046;
360
- repeated int64 repeated_int64 = 2047;
361
-
362
- // Three byte tags.
363
- repeated float repeated_float = 262142;
364
- repeated uint64 repeated_uint64 = 262143;
365
- }
366
-
367
- message TestCommentInjectionMessage {
368
- // */ <- This should not close the generated doc comment
369
- string a = 1;
370
- }
371
-
372
-
373
- // Test that RPC services work.
374
- message FooRequest {}
375
- message FooResponse {}
376
-
377
- message FooClientMessage {}
378
- message FooServerMessage{}
379
-
380
- service TestService {
381
- rpc Foo(FooRequest) returns (FooResponse);
382
- rpc Bar(BarRequest) returns (BarResponse);
383
- }
384
-
385
-
386
- message BarRequest {}
387
- message BarResponse {}
388
-
@@ -1,206 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- syntax = "proto3";
32
-
33
- option cc_enable_arenas = true;
34
-
35
- import "google/protobuf/unittest_import.proto";
36
-
37
- package proto3_arena_unittest;
38
-
39
- // This proto includes every type of field in both singular and repeated
40
- // forms.
41
- message TestAllTypes {
42
- message NestedMessage {
43
- // The field name "b" fails to compile in proto1 because it conflicts with
44
- // a local variable named "b" in one of the generated methods. Doh.
45
- // This file needs to compile in proto1 to test backwards-compatibility.
46
- int32 bb = 1;
47
- }
48
-
49
- enum NestedEnum {
50
- ZERO = 0;
51
- FOO = 1;
52
- BAR = 2;
53
- BAZ = 3;
54
- NEG = -1; // Intentionally negative.
55
- }
56
-
57
- // Singular
58
- int32 optional_int32 = 1;
59
- int64 optional_int64 = 2;
60
- uint32 optional_uint32 = 3;
61
- uint64 optional_uint64 = 4;
62
- sint32 optional_sint32 = 5;
63
- sint64 optional_sint64 = 6;
64
- fixed32 optional_fixed32 = 7;
65
- fixed64 optional_fixed64 = 8;
66
- sfixed32 optional_sfixed32 = 9;
67
- sfixed64 optional_sfixed64 = 10;
68
- float optional_float = 11;
69
- double optional_double = 12;
70
- bool optional_bool = 13;
71
- string optional_string = 14;
72
- bytes optional_bytes = 15;
73
-
74
- // Groups are not allowed in proto3.
75
- // optional group OptionalGroup = 16 {
76
- // optional int32 a = 17;
77
- // }
78
-
79
- NestedMessage optional_nested_message = 18;
80
- ForeignMessage optional_foreign_message = 19;
81
- protobuf_unittest_import.ImportMessage optional_import_message = 20;
82
-
83
- NestedEnum optional_nested_enum = 21;
84
- ForeignEnum optional_foreign_enum = 22;
85
-
86
- // Omitted (compared to unittest.proto) because proto2 enums are not allowed
87
- // inside proto2 messages.
88
- //
89
- // optional protobuf_unittest_import.ImportEnum optional_import_enum = 23;
90
-
91
- string optional_string_piece = 24 [ctype=STRING_PIECE];
92
- string optional_cord = 25 [ctype=CORD];
93
-
94
- // Defined in unittest_import_public.proto
95
- protobuf_unittest_import.PublicImportMessage
96
- optional_public_import_message = 26;
97
-
98
- NestedMessage optional_lazy_message = 27 [lazy=true];
99
-
100
- // Repeated
101
- repeated int32 repeated_int32 = 31;
102
- repeated int64 repeated_int64 = 32;
103
- repeated uint32 repeated_uint32 = 33;
104
- repeated uint64 repeated_uint64 = 34;
105
- repeated sint32 repeated_sint32 = 35;
106
- repeated sint64 repeated_sint64 = 36;
107
- repeated fixed32 repeated_fixed32 = 37;
108
- repeated fixed64 repeated_fixed64 = 38;
109
- repeated sfixed32 repeated_sfixed32 = 39;
110
- repeated sfixed64 repeated_sfixed64 = 40;
111
- repeated float repeated_float = 41;
112
- repeated double repeated_double = 42;
113
- repeated bool repeated_bool = 43;
114
- repeated string repeated_string = 44;
115
- repeated bytes repeated_bytes = 45;
116
-
117
- // Groups are not allowed in proto3.
118
- // repeated group RepeatedGroup = 46 {
119
- // optional int32 a = 47;
120
- // }
121
-
122
- repeated NestedMessage repeated_nested_message = 48;
123
- repeated ForeignMessage repeated_foreign_message = 49;
124
- repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50;
125
-
126
- repeated NestedEnum repeated_nested_enum = 51;
127
- repeated ForeignEnum repeated_foreign_enum = 52;
128
-
129
- // Omitted (compared to unittest.proto) because proto2 enums are not allowed
130
- // inside proto2 messages.
131
- //
132
- // repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53;
133
-
134
- repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
135
- repeated string repeated_cord = 55 [ctype=CORD];
136
-
137
- repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
138
-
139
- oneof oneof_field {
140
- uint32 oneof_uint32 = 111;
141
- NestedMessage oneof_nested_message = 112;
142
- string oneof_string = 113;
143
- bytes oneof_bytes = 114;
144
- }
145
- }
146
-
147
- // Test messages for packed fields
148
-
149
- message TestPackedTypes {
150
- repeated int32 packed_int32 = 90 [packed = true];
151
- repeated int64 packed_int64 = 91 [packed = true];
152
- repeated uint32 packed_uint32 = 92 [packed = true];
153
- repeated uint64 packed_uint64 = 93 [packed = true];
154
- repeated sint32 packed_sint32 = 94 [packed = true];
155
- repeated sint64 packed_sint64 = 95 [packed = true];
156
- repeated fixed32 packed_fixed32 = 96 [packed = true];
157
- repeated fixed64 packed_fixed64 = 97 [packed = true];
158
- repeated sfixed32 packed_sfixed32 = 98 [packed = true];
159
- repeated sfixed64 packed_sfixed64 = 99 [packed = true];
160
- repeated float packed_float = 100 [packed = true];
161
- repeated double packed_double = 101 [packed = true];
162
- repeated bool packed_bool = 102 [packed = true];
163
- repeated ForeignEnum packed_enum = 103 [packed = true];
164
- }
165
-
166
- // Explicitly set packed to false
167
- message TestUnpackedTypes {
168
- repeated int32 repeated_int32 = 1 [packed = false];
169
- repeated int64 repeated_int64 = 2 [packed = false];
170
- repeated uint32 repeated_uint32 = 3 [packed = false];
171
- repeated uint64 repeated_uint64 = 4 [packed = false];
172
- repeated sint32 repeated_sint32 = 5 [packed = false];
173
- repeated sint64 repeated_sint64 = 6 [packed = false];
174
- repeated fixed32 repeated_fixed32 = 7 [packed = false];
175
- repeated fixed64 repeated_fixed64 = 8 [packed = false];
176
- repeated sfixed32 repeated_sfixed32 = 9 [packed = false];
177
- repeated sfixed64 repeated_sfixed64 = 10 [packed = false];
178
- repeated float repeated_float = 11 [packed = false];
179
- repeated double repeated_double = 12 [packed = false];
180
- repeated bool repeated_bool = 13 [packed = false];
181
- repeated TestAllTypes.NestedEnum repeated_nested_enum = 14 [packed = false];
182
- }
183
-
184
- // This proto includes a recusively nested message.
185
- message NestedTestAllTypes {
186
- NestedTestAllTypes child = 1;
187
- TestAllTypes payload = 2;
188
- }
189
-
190
- // Define these after TestAllTypes to make sure the compiler can handle
191
- // that.
192
- message ForeignMessage {
193
- int32 c = 1;
194
- }
195
-
196
- enum ForeignEnum {
197
- FOREIGN_ZERO = 0;
198
- FOREIGN_FOO = 4;
199
- FOREIGN_BAR = 5;
200
- FOREIGN_BAZ = 6;
201
- }
202
-
203
- // TestEmptyMessage is used to test behavior of unknown fields.
204
- message TestEmptyMessage {
205
- }
206
-
@@ -1,112 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package protobuf_unittest;
4
-
5
- option csharp_namespace = "Google.Protobuf.TestProtos";
6
- option java_multiple_files = true;
7
- option java_package = "com.google.protobuf.test";
8
-
9
- import "google/protobuf/any.proto";
10
- import "google/protobuf/api.proto";
11
- import "google/protobuf/duration.proto";
12
- import "google/protobuf/empty.proto";
13
- import "google/protobuf/field_mask.proto";
14
- import "google/protobuf/source_context.proto";
15
- import "google/protobuf/struct.proto";
16
- import "google/protobuf/timestamp.proto";
17
- import "google/protobuf/type.proto";
18
- import "google/protobuf/wrappers.proto";
19
-
20
- // Test that we can include all well-known types.
21
- // Each wrapper type is included separately, as languages
22
- // map handle different wrappers in different ways.
23
- message TestWellKnownTypes {
24
- google.protobuf.Any any_field = 1;
25
- google.protobuf.Api api_field = 2;
26
- google.protobuf.Duration duration_field = 3;
27
- google.protobuf.Empty empty_field = 4;
28
- google.protobuf.FieldMask field_mask_field = 5;
29
- google.protobuf.SourceContext source_context_field = 6;
30
- google.protobuf.Struct struct_field = 7;
31
- google.protobuf.Timestamp timestamp_field = 8;
32
- google.protobuf.Type type_field = 9;
33
- google.protobuf.DoubleValue double_field = 10;
34
- google.protobuf.FloatValue float_field = 11;
35
- google.protobuf.Int64Value int64_field = 12;
36
- google.protobuf.UInt64Value uint64_field = 13;
37
- google.protobuf.Int32Value int32_field = 14;
38
- google.protobuf.UInt32Value uint32_field = 15;
39
- google.protobuf.BoolValue bool_field = 16;
40
- google.protobuf.StringValue string_field = 17;
41
- google.protobuf.BytesValue bytes_field = 18;
42
- }
43
-
44
- // A repeated field for each well-known type.
45
- message RepeatedWellKnownTypes {
46
- repeated google.protobuf.Any any_field = 1;
47
- repeated google.protobuf.Api api_field = 2;
48
- repeated google.protobuf.Duration duration_field = 3;
49
- repeated google.protobuf.Empty empty_field = 4;
50
- repeated google.protobuf.FieldMask field_mask_field = 5;
51
- repeated google.protobuf.SourceContext source_context_field = 6;
52
- repeated google.protobuf.Struct struct_field = 7;
53
- repeated google.protobuf.Timestamp timestamp_field = 8;
54
- repeated google.protobuf.Type type_field = 9;
55
- // These don't actually make a lot of sense, but they're not prohibited...
56
- repeated google.protobuf.DoubleValue double_field = 10;
57
- repeated google.protobuf.FloatValue float_field = 11;
58
- repeated google.protobuf.Int64Value int64_field = 12;
59
- repeated google.protobuf.UInt64Value uint64_field = 13;
60
- repeated google.protobuf.Int32Value int32_field = 14;
61
- repeated google.protobuf.UInt32Value uint32_field = 15;
62
- repeated google.protobuf.BoolValue bool_field = 16;
63
- repeated google.protobuf.StringValue string_field = 17;
64
- repeated google.protobuf.BytesValue bytes_field = 18;
65
- }
66
-
67
- message OneofWellKnownTypes {
68
- oneof oneof_field {
69
- google.protobuf.Any any_field = 1;
70
- google.protobuf.Api api_field = 2;
71
- google.protobuf.Duration duration_field = 3;
72
- google.protobuf.Empty empty_field = 4;
73
- google.protobuf.FieldMask field_mask_field = 5;
74
- google.protobuf.SourceContext source_context_field = 6;
75
- google.protobuf.Struct struct_field = 7;
76
- google.protobuf.Timestamp timestamp_field = 8;
77
- google.protobuf.Type type_field = 9;
78
- google.protobuf.DoubleValue double_field = 10;
79
- google.protobuf.FloatValue float_field = 11;
80
- google.protobuf.Int64Value int64_field = 12;
81
- google.protobuf.UInt64Value uint64_field = 13;
82
- google.protobuf.Int32Value int32_field = 14;
83
- google.protobuf.UInt32Value uint32_field = 15;
84
- google.protobuf.BoolValue bool_field = 16;
85
- google.protobuf.StringValue string_field = 17;
86
- google.protobuf.BytesValue bytes_field = 18;
87
- }
88
- }
89
-
90
- // A map field for each well-known type. We only
91
- // need to worry about the value part of the map being the
92
- // well-known types, as messages can't be map keys.
93
- message MapWellKnownTypes {
94
- map<int32,google.protobuf.Any> any_field = 1;
95
- map<int32,google.protobuf.Api> api_field = 2;
96
- map<int32,google.protobuf.Duration> duration_field = 3;
97
- map<int32,google.protobuf.Empty> empty_field = 4;
98
- map<int32,google.protobuf.FieldMask> field_mask_field = 5;
99
- map<int32,google.protobuf.SourceContext> source_context_field = 6;
100
- map<int32,google.protobuf.Struct> struct_field = 7;
101
- map<int32,google.protobuf.Timestamp> timestamp_field = 8;
102
- map<int32,google.protobuf.Type> type_field = 9;
103
- map<int32,google.protobuf.DoubleValue> double_field = 10;
104
- map<int32,google.protobuf.FloatValue> float_field = 11;
105
- map<int32,google.protobuf.Int64Value> int64_field = 12;
106
- map<int32,google.protobuf.UInt64Value> uint64_field = 13;
107
- map<int32,google.protobuf.Int32Value> int32_field = 14;
108
- map<int32,google.protobuf.UInt32Value> uint32_field = 15;
109
- map<int32,google.protobuf.BoolValue> bool_field = 16;
110
- map<int32,google.protobuf.StringValue> string_field = 17;
111
- map<int32,google.protobuf.BytesValue> bytes_field = 18;
112
- }