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,773 +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
- // The messages in this file describe the definitions found in .proto files.
36
- // A valid .proto file can be translated directly to a FileDescriptorProto
37
- // without any other information (e.g. without reading its imports).
38
-
39
-
40
- syntax = "proto2";
41
-
42
- package google.protobuf;
43
- option go_package = "descriptor";
44
- option java_package = "com.google.protobuf";
45
- option java_outer_classname = "DescriptorProtos";
46
- option csharp_namespace = "Google.Protobuf.Reflection";
47
- option objc_class_prefix = "GPB";
48
-
49
- // descriptor.proto must be optimized for speed because reflection-based
50
- // algorithms don't work during bootstrapping.
51
- option optimize_for = SPEED;
52
-
53
- // The protocol compiler can output a FileDescriptorSet containing the .proto
54
- // files it parses.
55
- message FileDescriptorSet {
56
- repeated FileDescriptorProto file = 1;
57
- }
58
-
59
- // Describes a complete .proto file.
60
- message FileDescriptorProto {
61
- optional string name = 1; // file name, relative to root of source tree
62
- optional string package = 2; // e.g. "foo", "foo.bar", etc.
63
-
64
- // Names of files imported by this file.
65
- repeated string dependency = 3;
66
- // Indexes of the public imported files in the dependency list above.
67
- repeated int32 public_dependency = 10;
68
- // Indexes of the weak imported files in the dependency list.
69
- // For Google-internal migration only. Do not use.
70
- repeated int32 weak_dependency = 11;
71
-
72
- // All top-level definitions in this file.
73
- repeated DescriptorProto message_type = 4;
74
- repeated EnumDescriptorProto enum_type = 5;
75
- repeated ServiceDescriptorProto service = 6;
76
- repeated FieldDescriptorProto extension = 7;
77
-
78
- optional FileOptions options = 8;
79
-
80
- // This field contains optional information about the original source code.
81
- // You may safely remove this entire field without harming runtime
82
- // functionality of the descriptors -- the information is needed only by
83
- // development tools.
84
- optional SourceCodeInfo source_code_info = 9;
85
-
86
- // The syntax of the proto file.
87
- // The supported values are "proto2" and "proto3".
88
- optional string syntax = 12;
89
- }
90
-
91
- // Describes a message type.
92
- message DescriptorProto {
93
- optional string name = 1;
94
-
95
- repeated FieldDescriptorProto field = 2;
96
- repeated FieldDescriptorProto extension = 6;
97
-
98
- repeated DescriptorProto nested_type = 3;
99
- repeated EnumDescriptorProto enum_type = 4;
100
-
101
- message ExtensionRange {
102
- optional int32 start = 1;
103
- optional int32 end = 2;
104
- }
105
- repeated ExtensionRange extension_range = 5;
106
-
107
- repeated OneofDescriptorProto oneof_decl = 8;
108
-
109
- optional MessageOptions options = 7;
110
-
111
- // Range of reserved tag numbers. Reserved tag numbers may not be used by
112
- // fields or extension ranges in the same message. Reserved ranges may
113
- // not overlap.
114
- message ReservedRange {
115
- optional int32 start = 1; // Inclusive.
116
- optional int32 end = 2; // Exclusive.
117
- }
118
- repeated ReservedRange reserved_range = 9;
119
- // Reserved field names, which may not be used by fields in the same message.
120
- // A given name may only be reserved once.
121
- repeated string reserved_name = 10;
122
- }
123
-
124
- // Describes a field within a message.
125
- message FieldDescriptorProto {
126
- enum Type {
127
- // 0 is reserved for errors.
128
- // Order is weird for historical reasons.
129
- TYPE_DOUBLE = 1;
130
- TYPE_FLOAT = 2;
131
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
132
- // negative values are likely.
133
- TYPE_INT64 = 3;
134
- TYPE_UINT64 = 4;
135
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
136
- // negative values are likely.
137
- TYPE_INT32 = 5;
138
- TYPE_FIXED64 = 6;
139
- TYPE_FIXED32 = 7;
140
- TYPE_BOOL = 8;
141
- TYPE_STRING = 9;
142
- TYPE_GROUP = 10; // Tag-delimited aggregate.
143
- TYPE_MESSAGE = 11; // Length-delimited aggregate.
144
-
145
- // New in version 2.
146
- TYPE_BYTES = 12;
147
- TYPE_UINT32 = 13;
148
- TYPE_ENUM = 14;
149
- TYPE_SFIXED32 = 15;
150
- TYPE_SFIXED64 = 16;
151
- TYPE_SINT32 = 17; // Uses ZigZag encoding.
152
- TYPE_SINT64 = 18; // Uses ZigZag encoding.
153
- };
154
-
155
- enum Label {
156
- // 0 is reserved for errors
157
- LABEL_OPTIONAL = 1;
158
- LABEL_REQUIRED = 2;
159
- LABEL_REPEATED = 3;
160
- // TODO(sanjay): Should we add LABEL_MAP?
161
- };
162
-
163
- optional string name = 1;
164
- optional int32 number = 3;
165
- optional Label label = 4;
166
-
167
- // If type_name is set, this need not be set. If both this and type_name
168
- // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
169
- optional Type type = 5;
170
-
171
- // For message and enum types, this is the name of the type. If the name
172
- // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
173
- // rules are used to find the type (i.e. first the nested types within this
174
- // message are searched, then within the parent, on up to the root
175
- // namespace).
176
- optional string type_name = 6;
177
-
178
- // For extensions, this is the name of the type being extended. It is
179
- // resolved in the same manner as type_name.
180
- optional string extendee = 2;
181
-
182
- // For numeric types, contains the original text representation of the value.
183
- // For booleans, "true" or "false".
184
- // For strings, contains the default text contents (not escaped in any way).
185
- // For bytes, contains the C escaped value. All bytes >= 128 are escaped.
186
- // TODO(kenton): Base-64 encode?
187
- optional string default_value = 7;
188
-
189
- // If set, gives the index of a oneof in the containing type's oneof_decl
190
- // list. This field is a member of that oneof.
191
- optional int32 oneof_index = 9;
192
-
193
- optional FieldOptions options = 8;
194
- }
195
-
196
- // Describes a oneof.
197
- message OneofDescriptorProto {
198
- optional string name = 1;
199
- }
200
-
201
- // Describes an enum type.
202
- message EnumDescriptorProto {
203
- optional string name = 1;
204
-
205
- repeated EnumValueDescriptorProto value = 2;
206
-
207
- optional EnumOptions options = 3;
208
- }
209
-
210
- // Describes a value within an enum.
211
- message EnumValueDescriptorProto {
212
- optional string name = 1;
213
- optional int32 number = 2;
214
-
215
- optional EnumValueOptions options = 3;
216
- }
217
-
218
- // Describes a service.
219
- message ServiceDescriptorProto {
220
- optional string name = 1;
221
- repeated MethodDescriptorProto method = 2;
222
-
223
- optional ServiceOptions options = 3;
224
- }
225
-
226
- // Describes a method of a service.
227
- message MethodDescriptorProto {
228
- optional string name = 1;
229
-
230
- // Input and output type names. These are resolved in the same way as
231
- // FieldDescriptorProto.type_name, but must refer to a message type.
232
- optional string input_type = 2;
233
- optional string output_type = 3;
234
-
235
- optional MethodOptions options = 4;
236
-
237
- // Identifies if client streams multiple client messages
238
- optional bool client_streaming = 5 [default=false];
239
- // Identifies if server streams multiple server messages
240
- optional bool server_streaming = 6 [default=false];
241
- }
242
-
243
-
244
- // ===================================================================
245
- // Options
246
-
247
- // Each of the definitions above may have "options" attached. These are
248
- // just annotations which may cause code to be generated slightly differently
249
- // or may contain hints for code that manipulates protocol messages.
250
- //
251
- // Clients may define custom options as extensions of the *Options messages.
252
- // These extensions may not yet be known at parsing time, so the parser cannot
253
- // store the values in them. Instead it stores them in a field in the *Options
254
- // message called uninterpreted_option. This field must have the same name
255
- // across all *Options messages. We then use this field to populate the
256
- // extensions when we build a descriptor, at which point all protos have been
257
- // parsed and so all extensions are known.
258
- //
259
- // Extension numbers for custom options may be chosen as follows:
260
- // * For options which will only be used within a single application or
261
- // organization, or for experimental options, use field numbers 50000
262
- // through 99999. It is up to you to ensure that you do not use the
263
- // same number for multiple options.
264
- // * For options which will be published and used publicly by multiple
265
- // independent entities, e-mail protobuf-global-extension-registry@google.com
266
- // to reserve extension numbers. Simply provide your project name (e.g.
267
- // Objective-C plugin) and your project website (if available) -- there's no
268
- // need to explain how you intend to use them. Usually you only need one
269
- // extension number. You can declare multiple options with only one extension
270
- // number by putting them in a sub-message. See the Custom Options section of
271
- // the docs for examples:
272
- // https://developers.google.com/protocol-buffers/docs/proto#options
273
- // If this turns out to be popular, a web service will be set up
274
- // to automatically assign option numbers.
275
-
276
-
277
- message FileOptions {
278
-
279
- // Sets the Java package where classes generated from this .proto will be
280
- // placed. By default, the proto package is used, but this is often
281
- // inappropriate because proto packages do not normally start with backwards
282
- // domain names.
283
- optional string java_package = 1;
284
-
285
-
286
- // If set, all the classes from the .proto file are wrapped in a single
287
- // outer class with the given name. This applies to both Proto1
288
- // (equivalent to the old "--one_java_file" option) and Proto2 (where
289
- // a .proto always translates to a single class, but you may want to
290
- // explicitly choose the class name).
291
- optional string java_outer_classname = 8;
292
-
293
- // If set true, then the Java code generator will generate a separate .java
294
- // file for each top-level message, enum, and service defined in the .proto
295
- // file. Thus, these types will *not* be nested inside the outer class
296
- // named by java_outer_classname. However, the outer class will still be
297
- // generated to contain the file's getDescriptor() method as well as any
298
- // top-level extensions defined in the file.
299
- optional bool java_multiple_files = 10 [default=false];
300
-
301
- // If set true, then the Java code generator will generate equals() and
302
- // hashCode() methods for all messages defined in the .proto file.
303
- // This increases generated code size, potentially substantially for large
304
- // protos, which may harm a memory-constrained application.
305
- // - In the full runtime this is a speed optimization, as the
306
- // AbstractMessage base class includes reflection-based implementations of
307
- // these methods.
308
- // - In the lite runtime, setting this option changes the semantics of
309
- // equals() and hashCode() to more closely match those of the full runtime;
310
- // the generated methods compute their results based on field values rather
311
- // than object identity. (Implementations should not assume that hashcodes
312
- // will be consistent across runtimes or versions of the protocol compiler.)
313
- optional bool java_generate_equals_and_hash = 20 [default=false];
314
-
315
- // If set true, then the Java2 code generator will generate code that
316
- // throws an exception whenever an attempt is made to assign a non-UTF-8
317
- // byte sequence to a string field.
318
- // Message reflection will do the same.
319
- // However, an extension field still accepts non-UTF-8 byte sequences.
320
- // This option has no effect on when used with the lite runtime.
321
- optional bool java_string_check_utf8 = 27 [default=false];
322
-
323
-
324
- // Generated classes can be optimized for speed or code size.
325
- enum OptimizeMode {
326
- SPEED = 1; // Generate complete code for parsing, serialization,
327
- // etc.
328
- CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
329
- LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
330
- }
331
- optional OptimizeMode optimize_for = 9 [default=SPEED];
332
-
333
- // Sets the Go package where structs generated from this .proto will be
334
- // placed. If omitted, the Go package will be derived from the following:
335
- // - The basename of the package import path, if provided.
336
- // - Otherwise, the package statement in the .proto file, if present.
337
- // - Otherwise, the basename of the .proto file, without extension.
338
- optional string go_package = 11;
339
-
340
-
341
-
342
- // Should generic services be generated in each language? "Generic" services
343
- // are not specific to any particular RPC system. They are generated by the
344
- // main code generators in each language (without additional plugins).
345
- // Generic services were the only kind of service generation supported by
346
- // early versions of google.protobuf.
347
- //
348
- // Generic services are now considered deprecated in favor of using plugins
349
- // that generate code specific to your particular RPC system. Therefore,
350
- // these default to false. Old code which depends on generic services should
351
- // explicitly set them to true.
352
- optional bool cc_generic_services = 16 [default=false];
353
- optional bool java_generic_services = 17 [default=false];
354
- optional bool py_generic_services = 18 [default=false];
355
-
356
- // Is this file deprecated?
357
- // Depending on the target platform, this can emit Deprecated annotations
358
- // for everything in the file, or it will be completely ignored; in the very
359
- // least, this is a formalization for deprecating files.
360
- optional bool deprecated = 23 [default=false];
361
-
362
- // Enables the use of arenas for the proto messages in this file. This applies
363
- // only to generated classes for C++.
364
- optional bool cc_enable_arenas = 31 [default=false];
365
-
366
-
367
- // Sets the objective c class prefix which is prepended to all objective c
368
- // generated classes from this .proto. There is no default.
369
- optional string objc_class_prefix = 36;
370
-
371
- // Namespace for generated classes; defaults to the package.
372
- optional string csharp_namespace = 37;
373
-
374
- // Whether the nano proto compiler should generate in the deprecated non-nano
375
- // suffixed package.
376
- optional bool javanano_use_deprecated_package = 38;
377
-
378
- // The parser stores options it doesn't recognize here. See above.
379
- repeated UninterpretedOption uninterpreted_option = 999;
380
-
381
- // Clients can define custom options in extensions of this message. See above.
382
- extensions 1000 to max;
383
- }
384
-
385
- message MessageOptions {
386
- // Set true to use the old proto1 MessageSet wire format for extensions.
387
- // This is provided for backwards-compatibility with the MessageSet wire
388
- // format. You should not use this for any other reason: It's less
389
- // efficient, has fewer features, and is more complicated.
390
- //
391
- // The message must be defined exactly as follows:
392
- // message Foo {
393
- // option message_set_wire_format = true;
394
- // extensions 4 to max;
395
- // }
396
- // Note that the message cannot have any defined fields; MessageSets only
397
- // have extensions.
398
- //
399
- // All extensions of your type must be singular messages; e.g. they cannot
400
- // be int32s, enums, or repeated messages.
401
- //
402
- // Because this is an option, the above two restrictions are not enforced by
403
- // the protocol compiler.
404
- optional bool message_set_wire_format = 1 [default=false];
405
-
406
- // Disables the generation of the standard "descriptor()" accessor, which can
407
- // conflict with a field of the same name. This is meant to make migration
408
- // from proto1 easier; new code should avoid fields named "descriptor".
409
- optional bool no_standard_descriptor_accessor = 2 [default=false];
410
-
411
- // Is this message deprecated?
412
- // Depending on the target platform, this can emit Deprecated annotations
413
- // for the message, or it will be completely ignored; in the very least,
414
- // this is a formalization for deprecating messages.
415
- optional bool deprecated = 3 [default=false];
416
-
417
- // Whether the message is an automatically generated map entry type for the
418
- // maps field.
419
- //
420
- // For maps fields:
421
- // map<KeyType, ValueType> map_field = 1;
422
- // The parsed descriptor looks like:
423
- // message MapFieldEntry {
424
- // option map_entry = true;
425
- // optional KeyType key = 1;
426
- // optional ValueType value = 2;
427
- // }
428
- // repeated MapFieldEntry map_field = 1;
429
- //
430
- // Implementations may choose not to generate the map_entry=true message, but
431
- // use a native map in the target language to hold the keys and values.
432
- // The reflection APIs in such implementions still need to work as
433
- // if the field is a repeated message field.
434
- //
435
- // NOTE: Do not set the option in .proto files. Always use the maps syntax
436
- // instead. The option should only be implicitly set by the proto compiler
437
- // parser.
438
- optional bool map_entry = 7;
439
-
440
- // The parser stores options it doesn't recognize here. See above.
441
- repeated UninterpretedOption uninterpreted_option = 999;
442
-
443
- // Clients can define custom options in extensions of this message. See above.
444
- extensions 1000 to max;
445
- }
446
-
447
- message FieldOptions {
448
- // The ctype option instructs the C++ code generator to use a different
449
- // representation of the field than it normally would. See the specific
450
- // options below. This option is not yet implemented in the open source
451
- // release -- sorry, we'll try to include it in a future version!
452
- optional CType ctype = 1 [default = STRING];
453
- enum CType {
454
- // Default mode.
455
- STRING = 0;
456
-
457
- CORD = 1;
458
-
459
- STRING_PIECE = 2;
460
- }
461
- // The packed option can be enabled for repeated primitive fields to enable
462
- // a more efficient representation on the wire. Rather than repeatedly
463
- // writing the tag and type for each element, the entire array is encoded as
464
- // a single length-delimited blob. In proto3, only explicit setting it to
465
- // false will avoid using packed encoding.
466
- optional bool packed = 2;
467
-
468
-
469
- // The jstype option determines the JavaScript type used for values of the
470
- // field. The option is permitted only for 64 bit integral and fixed types
471
- // (int64, uint64, sint64, fixed64, sfixed64). By default these types are
472
- // represented as JavaScript strings. This avoids loss of precision that can
473
- // happen when a large value is converted to a floating point JavaScript
474
- // numbers. Specifying JS_NUMBER for the jstype causes the generated
475
- // JavaScript code to use the JavaScript "number" type instead of strings.
476
- // This option is an enum to permit additional types to be added,
477
- // e.g. goog.math.Integer.
478
- optional JSType jstype = 6 [default = JS_NORMAL];
479
- enum JSType {
480
- // Use the default type.
481
- JS_NORMAL = 0;
482
-
483
- // Use JavaScript strings.
484
- JS_STRING = 1;
485
-
486
- // Use JavaScript numbers.
487
- JS_NUMBER = 2;
488
- }
489
-
490
- // Should this field be parsed lazily? Lazy applies only to message-type
491
- // fields. It means that when the outer message is initially parsed, the
492
- // inner message's contents will not be parsed but instead stored in encoded
493
- // form. The inner message will actually be parsed when it is first accessed.
494
- //
495
- // This is only a hint. Implementations are free to choose whether to use
496
- // eager or lazy parsing regardless of the value of this option. However,
497
- // setting this option true suggests that the protocol author believes that
498
- // using lazy parsing on this field is worth the additional bookkeeping
499
- // overhead typically needed to implement it.
500
- //
501
- // This option does not affect the public interface of any generated code;
502
- // all method signatures remain the same. Furthermore, thread-safety of the
503
- // interface is not affected by this option; const methods remain safe to
504
- // call from multiple threads concurrently, while non-const methods continue
505
- // to require exclusive access.
506
- //
507
- //
508
- // Note that implementations may choose not to check required fields within
509
- // a lazy sub-message. That is, calling IsInitialized() on the outher message
510
- // may return true even if the inner message has missing required fields.
511
- // This is necessary because otherwise the inner message would have to be
512
- // parsed in order to perform the check, defeating the purpose of lazy
513
- // parsing. An implementation which chooses not to check required fields
514
- // must be consistent about it. That is, for any particular sub-message, the
515
- // implementation must either *always* check its required fields, or *never*
516
- // check its required fields, regardless of whether or not the message has
517
- // been parsed.
518
- optional bool lazy = 5 [default=false];
519
-
520
- // Is this field deprecated?
521
- // Depending on the target platform, this can emit Deprecated annotations
522
- // for accessors, or it will be completely ignored; in the very least, this
523
- // is a formalization for deprecating fields.
524
- optional bool deprecated = 3 [default=false];
525
-
526
- // For Google-internal migration only. Do not use.
527
- optional bool weak = 10 [default=false];
528
-
529
-
530
- // The parser stores options it doesn't recognize here. See above.
531
- repeated UninterpretedOption uninterpreted_option = 999;
532
-
533
- // Clients can define custom options in extensions of this message. See above.
534
- extensions 1000 to max;
535
- }
536
-
537
- message EnumOptions {
538
-
539
- // Set this option to true to allow mapping different tag names to the same
540
- // value.
541
- optional bool allow_alias = 2;
542
-
543
- // Is this enum deprecated?
544
- // Depending on the target platform, this can emit Deprecated annotations
545
- // for the enum, or it will be completely ignored; in the very least, this
546
- // is a formalization for deprecating enums.
547
- optional bool deprecated = 3 [default=false];
548
-
549
- // The parser stores options it doesn't recognize here. See above.
550
- repeated UninterpretedOption uninterpreted_option = 999;
551
-
552
- // Clients can define custom options in extensions of this message. See above.
553
- extensions 1000 to max;
554
- }
555
-
556
- message EnumValueOptions {
557
- // Is this enum value deprecated?
558
- // Depending on the target platform, this can emit Deprecated annotations
559
- // for the enum value, or it will be completely ignored; in the very least,
560
- // this is a formalization for deprecating enum values.
561
- optional bool deprecated = 1 [default=false];
562
-
563
- // The parser stores options it doesn't recognize here. See above.
564
- repeated UninterpretedOption uninterpreted_option = 999;
565
-
566
- // Clients can define custom options in extensions of this message. See above.
567
- extensions 1000 to max;
568
- }
569
-
570
- message ServiceOptions {
571
-
572
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
573
- // framework. We apologize for hoarding these numbers to ourselves, but
574
- // we were already using them long before we decided to release Protocol
575
- // Buffers.
576
-
577
- // Is this service deprecated?
578
- // Depending on the target platform, this can emit Deprecated annotations
579
- // for the service, or it will be completely ignored; in the very least,
580
- // this is a formalization for deprecating services.
581
- optional bool deprecated = 33 [default=false];
582
-
583
- // The parser stores options it doesn't recognize here. See above.
584
- repeated UninterpretedOption uninterpreted_option = 999;
585
-
586
- // Clients can define custom options in extensions of this message. See above.
587
- extensions 1000 to max;
588
- }
589
-
590
- message MethodOptions {
591
-
592
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
593
- // framework. We apologize for hoarding these numbers to ourselves, but
594
- // we were already using them long before we decided to release Protocol
595
- // Buffers.
596
-
597
- // Is this method deprecated?
598
- // Depending on the target platform, this can emit Deprecated annotations
599
- // for the method, or it will be completely ignored; in the very least,
600
- // this is a formalization for deprecating methods.
601
- optional bool deprecated = 33 [default=false];
602
-
603
- // The parser stores options it doesn't recognize here. See above.
604
- repeated UninterpretedOption uninterpreted_option = 999;
605
-
606
- // Clients can define custom options in extensions of this message. See above.
607
- extensions 1000 to max;
608
- }
609
-
610
-
611
- // A message representing a option the parser does not recognize. This only
612
- // appears in options protos created by the compiler::Parser class.
613
- // DescriptorPool resolves these when building Descriptor objects. Therefore,
614
- // options protos in descriptor objects (e.g. returned by Descriptor::options(),
615
- // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
616
- // in them.
617
- message UninterpretedOption {
618
- // The name of the uninterpreted option. Each string represents a segment in
619
- // a dot-separated name. is_extension is true iff a segment represents an
620
- // extension (denoted with parentheses in options specs in .proto files).
621
- // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
622
- // "foo.(bar.baz).qux".
623
- message NamePart {
624
- required string name_part = 1;
625
- required bool is_extension = 2;
626
- }
627
- repeated NamePart name = 2;
628
-
629
- // The value of the uninterpreted option, in whatever type the tokenizer
630
- // identified it as during parsing. Exactly one of these should be set.
631
- optional string identifier_value = 3;
632
- optional uint64 positive_int_value = 4;
633
- optional int64 negative_int_value = 5;
634
- optional double double_value = 6;
635
- optional bytes string_value = 7;
636
- optional string aggregate_value = 8;
637
- }
638
-
639
- // ===================================================================
640
- // Optional source code info
641
-
642
- // Encapsulates information about the original source file from which a
643
- // FileDescriptorProto was generated.
644
- message SourceCodeInfo {
645
- // A Location identifies a piece of source code in a .proto file which
646
- // corresponds to a particular definition. This information is intended
647
- // to be useful to IDEs, code indexers, documentation generators, and similar
648
- // tools.
649
- //
650
- // For example, say we have a file like:
651
- // message Foo {
652
- // optional string foo = 1;
653
- // }
654
- // Let's look at just the field definition:
655
- // optional string foo = 1;
656
- // ^ ^^ ^^ ^ ^^^
657
- // a bc de f ghi
658
- // We have the following locations:
659
- // span path represents
660
- // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
661
- // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
662
- // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
663
- // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
664
- // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
665
- //
666
- // Notes:
667
- // - A location may refer to a repeated field itself (i.e. not to any
668
- // particular index within it). This is used whenever a set of elements are
669
- // logically enclosed in a single code segment. For example, an entire
670
- // extend block (possibly containing multiple extension definitions) will
671
- // have an outer location whose path refers to the "extensions" repeated
672
- // field without an index.
673
- // - Multiple locations may have the same path. This happens when a single
674
- // logical declaration is spread out across multiple places. The most
675
- // obvious example is the "extend" block again -- there may be multiple
676
- // extend blocks in the same scope, each of which will have the same path.
677
- // - A location's span is not always a subset of its parent's span. For
678
- // example, the "extendee" of an extension declaration appears at the
679
- // beginning of the "extend" block and is shared by all extensions within
680
- // the block.
681
- // - Just because a location's span is a subset of some other location's span
682
- // does not mean that it is a descendent. For example, a "group" defines
683
- // both a type and a field in a single declaration. Thus, the locations
684
- // corresponding to the type and field and their components will overlap.
685
- // - Code which tries to interpret locations should probably be designed to
686
- // ignore those that it doesn't understand, as more types of locations could
687
- // be recorded in the future.
688
- repeated Location location = 1;
689
- message Location {
690
- // Identifies which part of the FileDescriptorProto was defined at this
691
- // location.
692
- //
693
- // Each element is a field number or an index. They form a path from
694
- // the root FileDescriptorProto to the place where the definition. For
695
- // example, this path:
696
- // [ 4, 3, 2, 7, 1 ]
697
- // refers to:
698
- // file.message_type(3) // 4, 3
699
- // .field(7) // 2, 7
700
- // .name() // 1
701
- // This is because FileDescriptorProto.message_type has field number 4:
702
- // repeated DescriptorProto message_type = 4;
703
- // and DescriptorProto.field has field number 2:
704
- // repeated FieldDescriptorProto field = 2;
705
- // and FieldDescriptorProto.name has field number 1:
706
- // optional string name = 1;
707
- //
708
- // Thus, the above path gives the location of a field name. If we removed
709
- // the last element:
710
- // [ 4, 3, 2, 7 ]
711
- // this path refers to the whole field declaration (from the beginning
712
- // of the label to the terminating semicolon).
713
- repeated int32 path = 1 [packed=true];
714
-
715
- // Always has exactly three or four elements: start line, start column,
716
- // end line (optional, otherwise assumed same as start line), end column.
717
- // These are packed into a single field for efficiency. Note that line
718
- // and column numbers are zero-based -- typically you will want to add
719
- // 1 to each before displaying to a user.
720
- repeated int32 span = 2 [packed=true];
721
-
722
- // If this SourceCodeInfo represents a complete declaration, these are any
723
- // comments appearing before and after the declaration which appear to be
724
- // attached to the declaration.
725
- //
726
- // A series of line comments appearing on consecutive lines, with no other
727
- // tokens appearing on those lines, will be treated as a single comment.
728
- //
729
- // leading_detached_comments will keep paragraphs of comments that appear
730
- // before (but not connected to) the current element. Each paragraph,
731
- // separated by empty lines, will be one comment element in the repeated
732
- // field.
733
- //
734
- // Only the comment content is provided; comment markers (e.g. //) are
735
- // stripped out. For block comments, leading whitespace and an asterisk
736
- // will be stripped from the beginning of each line other than the first.
737
- // Newlines are included in the output.
738
- //
739
- // Examples:
740
- //
741
- // optional int32 foo = 1; // Comment attached to foo.
742
- // // Comment attached to bar.
743
- // optional int32 bar = 2;
744
- //
745
- // optional string baz = 3;
746
- // // Comment attached to baz.
747
- // // Another line attached to baz.
748
- //
749
- // // Comment attached to qux.
750
- // //
751
- // // Another line attached to qux.
752
- // optional double qux = 4;
753
- //
754
- // // Detached comment for corge. This is not leading or trailing comments
755
- // // to qux or corge because there are blank lines separating it from
756
- // // both.
757
- //
758
- // // Detached comment for corge paragraph 2.
759
- //
760
- // optional string corge = 5;
761
- // /* Block comment attached
762
- // * to corge. Leading asterisks
763
- // * will be removed. */
764
- // /* Block comment attached to
765
- // * grault. */
766
- // optional int32 grault = 6;
767
- //
768
- // // ignored detached comments.
769
- optional string leading_comments = 3;
770
- optional string trailing_comments = 4;
771
- repeated string leading_detached_comments = 6;
772
- }
773
- }