OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // http://code.google.com/p/protobuf/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
(...skipping 16 matching lines...) Expand all Loading... |
30 | 30 |
31 // Author: kenton@google.com (Kenton Varda) | 31 // Author: kenton@google.com (Kenton Varda) |
32 // Based on original Protocol Buffers design by | 32 // Based on original Protocol Buffers design by |
33 // Sanjay Ghemawat, Jeff Dean, and others. | 33 // Sanjay Ghemawat, Jeff Dean, and others. |
34 // | 34 // |
35 // The messages in this file describe the definitions found in .proto files. | 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 | 36 // A valid .proto file can be translated directly to a FileDescriptorProto |
37 // without any other information (e.g. without reading its imports). | 37 // without any other information (e.g. without reading its imports). |
38 | 38 |
39 | 39 |
40 syntax = "proto2"; | |
41 | 40 |
42 package google.protobuf; | 41 package google.protobuf; |
43 option go_package = "descriptor"; | |
44 option java_package = "com.google.protobuf"; | 42 option java_package = "com.google.protobuf"; |
45 option java_outer_classname = "DescriptorProtos"; | 43 option java_outer_classname = "DescriptorProtos"; |
46 option csharp_namespace = "Google.Protobuf.Reflection"; | |
47 option objc_class_prefix = "GPB"; | |
48 | 44 |
49 // descriptor.proto must be optimized for speed because reflection-based | 45 // descriptor.proto must be optimized for speed because reflection-based |
50 // algorithms don't work during bootstrapping. | 46 // algorithms don't work during bootstrapping. |
51 option optimize_for = SPEED; | 47 option optimize_for = SPEED; |
52 | 48 |
53 // The protocol compiler can output a FileDescriptorSet containing the .proto | 49 // The protocol compiler can output a FileDescriptorSet containing the .proto |
54 // files it parses. | 50 // files it parses. |
55 message FileDescriptorSet { | 51 message FileDescriptorSet { |
56 repeated FileDescriptorProto file = 1; | 52 repeated FileDescriptorProto file = 1; |
57 } | 53 } |
(...skipping 13 matching lines...) Expand all Loading... |
71 | 67 |
72 // All top-level definitions in this file. | 68 // All top-level definitions in this file. |
73 repeated DescriptorProto message_type = 4; | 69 repeated DescriptorProto message_type = 4; |
74 repeated EnumDescriptorProto enum_type = 5; | 70 repeated EnumDescriptorProto enum_type = 5; |
75 repeated ServiceDescriptorProto service = 6; | 71 repeated ServiceDescriptorProto service = 6; |
76 repeated FieldDescriptorProto extension = 7; | 72 repeated FieldDescriptorProto extension = 7; |
77 | 73 |
78 optional FileOptions options = 8; | 74 optional FileOptions options = 8; |
79 | 75 |
80 // This field contains optional information about the original source code. | 76 // This field contains optional information about the original source code. |
81 // You may safely remove this entire field without harming runtime | 77 // You may safely remove this entire field whithout harming runtime |
82 // functionality of the descriptors -- the information is needed only by | 78 // functionality of the descriptors -- the information is needed only by |
83 // development tools. | 79 // development tools. |
84 optional SourceCodeInfo source_code_info = 9; | 80 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 } | 81 } |
90 | 82 |
91 // Describes a message type. | 83 // Describes a message type. |
92 message DescriptorProto { | 84 message DescriptorProto { |
93 optional string name = 1; | 85 optional string name = 1; |
94 | 86 |
95 repeated FieldDescriptorProto field = 2; | 87 repeated FieldDescriptorProto field = 2; |
96 repeated FieldDescriptorProto extension = 6; | 88 repeated FieldDescriptorProto extension = 6; |
97 | 89 |
98 repeated DescriptorProto nested_type = 3; | 90 repeated DescriptorProto nested_type = 3; |
99 repeated EnumDescriptorProto enum_type = 4; | 91 repeated EnumDescriptorProto enum_type = 4; |
100 | 92 |
101 message ExtensionRange { | 93 message ExtensionRange { |
102 optional int32 start = 1; | 94 optional int32 start = 1; |
103 optional int32 end = 2; | 95 optional int32 end = 2; |
104 } | 96 } |
105 repeated ExtensionRange extension_range = 5; | 97 repeated ExtensionRange extension_range = 5; |
106 | 98 |
107 repeated OneofDescriptorProto oneof_decl = 8; | |
108 | |
109 optional MessageOptions options = 7; | 99 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 } | 100 } |
123 | 101 |
124 // Describes a field within a message. | 102 // Describes a field within a message. |
125 message FieldDescriptorProto { | 103 message FieldDescriptorProto { |
126 enum Type { | 104 enum Type { |
127 // 0 is reserved for errors. | 105 // 0 is reserved for errors. |
128 // Order is weird for historical reasons. | 106 // Order is weird for historical reasons. |
129 TYPE_DOUBLE = 1; | 107 TYPE_DOUBLE = 1; |
130 TYPE_FLOAT = 2; | 108 TYPE_FLOAT = 2; |
131 // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if | 109 // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if |
(...skipping 26 matching lines...) Expand all Loading... |
158 LABEL_REQUIRED = 2; | 136 LABEL_REQUIRED = 2; |
159 LABEL_REPEATED = 3; | 137 LABEL_REPEATED = 3; |
160 // TODO(sanjay): Should we add LABEL_MAP? | 138 // TODO(sanjay): Should we add LABEL_MAP? |
161 }; | 139 }; |
162 | 140 |
163 optional string name = 1; | 141 optional string name = 1; |
164 optional int32 number = 3; | 142 optional int32 number = 3; |
165 optional Label label = 4; | 143 optional Label label = 4; |
166 | 144 |
167 // If type_name is set, this need not be set. If both this and type_name | 145 // 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. | 146 // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. |
169 optional Type type = 5; | 147 optional Type type = 5; |
170 | 148 |
171 // For message and enum types, this is the name of the type. If the name | 149 // 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 | 150 // 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 | 151 // 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 | 152 // message are searched, then within the parent, on up to the root |
175 // namespace). | 153 // namespace). |
176 optional string type_name = 6; | 154 optional string type_name = 6; |
177 | 155 |
178 // For extensions, this is the name of the type being extended. It is | 156 // For extensions, this is the name of the type being extended. It is |
179 // resolved in the same manner as type_name. | 157 // resolved in the same manner as type_name. |
180 optional string extendee = 2; | 158 optional string extendee = 2; |
181 | 159 |
182 // For numeric types, contains the original text representation of the value. | 160 // For numeric types, contains the original text representation of the value. |
183 // For booleans, "true" or "false". | 161 // For booleans, "true" or "false". |
184 // For strings, contains the default text contents (not escaped in any way). | 162 // 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. | 163 // For bytes, contains the C escaped value. All bytes >= 128 are escaped. |
186 // TODO(kenton): Base-64 encode? | 164 // TODO(kenton): Base-64 encode? |
187 optional string default_value = 7; | 165 optional string default_value = 7; |
188 | 166 |
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 // JSON name of this field. The value is set by protocol compiler. If the | |
194 // user has set a "json_name" option on this field, that option's value | |
195 // will be used. Otherwise, it's deduced from the field's name by converting | |
196 // it to camelCase. | |
197 optional string json_name = 10; | |
198 | |
199 optional FieldOptions options = 8; | 167 optional FieldOptions options = 8; |
200 } | 168 } |
201 | 169 |
202 // Describes a oneof. | |
203 message OneofDescriptorProto { | |
204 optional string name = 1; | |
205 } | |
206 | |
207 // Describes an enum type. | 170 // Describes an enum type. |
208 message EnumDescriptorProto { | 171 message EnumDescriptorProto { |
209 optional string name = 1; | 172 optional string name = 1; |
210 | 173 |
211 repeated EnumValueDescriptorProto value = 2; | 174 repeated EnumValueDescriptorProto value = 2; |
212 | 175 |
213 optional EnumOptions options = 3; | 176 optional EnumOptions options = 3; |
214 } | 177 } |
215 | 178 |
216 // Describes a value within an enum. | 179 // Describes a value within an enum. |
(...skipping 15 matching lines...) Expand all Loading... |
232 // Describes a method of a service. | 195 // Describes a method of a service. |
233 message MethodDescriptorProto { | 196 message MethodDescriptorProto { |
234 optional string name = 1; | 197 optional string name = 1; |
235 | 198 |
236 // Input and output type names. These are resolved in the same way as | 199 // Input and output type names. These are resolved in the same way as |
237 // FieldDescriptorProto.type_name, but must refer to a message type. | 200 // FieldDescriptorProto.type_name, but must refer to a message type. |
238 optional string input_type = 2; | 201 optional string input_type = 2; |
239 optional string output_type = 3; | 202 optional string output_type = 3; |
240 | 203 |
241 optional MethodOptions options = 4; | 204 optional MethodOptions options = 4; |
242 | |
243 // Identifies if client streams multiple client messages | |
244 optional bool client_streaming = 5 [default=false]; | |
245 // Identifies if server streams multiple server messages | |
246 optional bool server_streaming = 6 [default=false]; | |
247 } | 205 } |
248 | 206 |
249 | 207 |
250 // =================================================================== | 208 // =================================================================== |
251 // Options | 209 // Options |
252 | 210 |
253 // Each of the definitions above may have "options" attached. These are | 211 // Each of the definitions above may have "options" attached. These are |
254 // just annotations which may cause code to be generated slightly differently | 212 // just annotations which may cause code to be generated slightly differently |
255 // or may contain hints for code that manipulates protocol messages. | 213 // or may contain hints for code that manipulates protocol messages. |
256 // | 214 // |
257 // Clients may define custom options as extensions of the *Options messages. | 215 // Clients may define custom options as extensions of the *Options messages. |
258 // These extensions may not yet be known at parsing time, so the parser cannot | 216 // These extensions may not yet be known at parsing time, so the parser cannot |
259 // store the values in them. Instead it stores them in a field in the *Options | 217 // store the values in them. Instead it stores them in a field in the *Options |
260 // message called uninterpreted_option. This field must have the same name | 218 // message called uninterpreted_option. This field must have the same name |
261 // across all *Options messages. We then use this field to populate the | 219 // across all *Options messages. We then use this field to populate the |
262 // extensions when we build a descriptor, at which point all protos have been | 220 // extensions when we build a descriptor, at which point all protos have been |
263 // parsed and so all extensions are known. | 221 // parsed and so all extensions are known. |
264 // | 222 // |
265 // Extension numbers for custom options may be chosen as follows: | 223 // Extension numbers for custom options may be chosen as follows: |
266 // * For options which will only be used within a single application or | 224 // * For options which will only be used within a single application or |
267 // organization, or for experimental options, use field numbers 50000 | 225 // organization, or for experimental options, use field numbers 50000 |
268 // through 99999. It is up to you to ensure that you do not use the | 226 // through 99999. It is up to you to ensure that you do not use the |
269 // same number for multiple options. | 227 // same number for multiple options. |
270 // * For options which will be published and used publicly by multiple | 228 // * For options which will be published and used publicly by multiple |
271 // independent entities, e-mail protobuf-global-extension-registry@google.com | 229 // independent entities, e-mail protobuf-global-extension-registry@google.com |
272 // to reserve extension numbers. Simply provide your project name (e.g. | 230 // to reserve extension numbers. Simply provide your project name (e.g. |
273 // Objective-C plugin) and your project website (if available) -- there's no | 231 // Object-C plugin) and your porject website (if available) -- there's no need |
274 // need to explain how you intend to use them. Usually you only need one | 232 // to explain how you intend to use them. Usually you only need one extension |
275 // extension number. You can declare multiple options with only one extension | 233 // number. You can declare multiple options with only one extension number by |
276 // number by putting them in a sub-message. See the Custom Options section of | 234 // putting them in a sub-message. See the Custom Options section of the docs |
277 // the docs for examples: | 235 // for examples: |
278 // https://developers.google.com/protocol-buffers/docs/proto#options | 236 // http://code.google.com/apis/protocolbuffers/docs/proto.html#options |
279 // If this turns out to be popular, a web service will be set up | 237 // If this turns out to be popular, a web service will be set up |
280 // to automatically assign option numbers. | 238 // to automatically assign option numbers. |
281 | 239 |
282 | 240 |
283 message FileOptions { | 241 message FileOptions { |
284 | 242 |
285 // Sets the Java package where classes generated from this .proto will be | 243 // Sets the Java package where classes generated from this .proto will be |
286 // placed. By default, the proto package is used, but this is often | 244 // placed. By default, the proto package is used, but this is often |
287 // inappropriate because proto packages do not normally start with backwards | 245 // inappropriate because proto packages do not normally start with backwards |
288 // domain names. | 246 // domain names. |
289 optional string java_package = 1; | 247 optional string java_package = 1; |
290 | 248 |
291 | 249 |
292 // If set, all the classes from the .proto file are wrapped in a single | 250 // If set, all the classes from the .proto file are wrapped in a single |
293 // outer class with the given name. This applies to both Proto1 | 251 // outer class with the given name. This applies to both Proto1 |
294 // (equivalent to the old "--one_java_file" option) and Proto2 (where | 252 // (equivalent to the old "--one_java_file" option) and Proto2 (where |
295 // a .proto always translates to a single class, but you may want to | 253 // a .proto always translates to a single class, but you may want to |
296 // explicitly choose the class name). | 254 // explicitly choose the class name). |
297 optional string java_outer_classname = 8; | 255 optional string java_outer_classname = 8; |
298 | 256 |
299 // If set true, then the Java code generator will generate a separate .java | 257 // If set true, then the Java code generator will generate a separate .java |
300 // file for each top-level message, enum, and service defined in the .proto | 258 // file for each top-level message, enum, and service defined in the .proto |
301 // file. Thus, these types will *not* be nested inside the outer class | 259 // file. Thus, these types will *not* be nested inside the outer class |
302 // named by java_outer_classname. However, the outer class will still be | 260 // named by java_outer_classname. However, the outer class will still be |
303 // generated to contain the file's getDescriptor() method as well as any | 261 // generated to contain the file's getDescriptor() method as well as any |
304 // top-level extensions defined in the file. | 262 // top-level extensions defined in the file. |
305 optional bool java_multiple_files = 10 [default=false]; | 263 optional bool java_multiple_files = 10 [default=false]; |
306 | 264 |
307 // If set true, then the Java code generator will generate equals() and | 265 // If set true, then the Java code generator will generate equals() and |
308 // hashCode() methods for all messages defined in the .proto file. | 266 // hashCode() methods for all messages defined in the .proto file. This is |
309 // This increases generated code size, potentially substantially for large | 267 // purely a speed optimization, as the AbstractMessage base class includes |
310 // protos, which may harm a memory-constrained application. | 268 // reflection-based implementations of these methods. |
311 // - In the full runtime this is a speed optimization, as the | |
312 // AbstractMessage base class includes reflection-based implementations of | |
313 // these methods. | |
314 // - In the lite runtime, setting this option changes the semantics of | |
315 // equals() and hashCode() to more closely match those of the full runtime; | |
316 // the generated methods compute their results based on field values rather | |
317 // than object identity. (Implementations should not assume that hashcodes | |
318 // will be consistent across runtimes or versions of the protocol compiler.) | |
319 optional bool java_generate_equals_and_hash = 20 [default=false]; | 269 optional bool java_generate_equals_and_hash = 20 [default=false]; |
320 | 270 |
321 // If set true, then the Java2 code generator will generate code that | |
322 // throws an exception whenever an attempt is made to assign a non-UTF-8 | |
323 // byte sequence to a string field. | |
324 // Message reflection will do the same. | |
325 // However, an extension field still accepts non-UTF-8 byte sequences. | |
326 // This option has no effect on when used with the lite runtime. | |
327 optional bool java_string_check_utf8 = 27 [default=false]; | |
328 | |
329 | |
330 // Generated classes can be optimized for speed or code size. | 271 // Generated classes can be optimized for speed or code size. |
331 enum OptimizeMode { | 272 enum OptimizeMode { |
332 SPEED = 1; // Generate complete code for parsing, serialization, | 273 SPEED = 1; // Generate complete code for parsing, serialization, |
333 // etc. | 274 // etc. |
334 CODE_SIZE = 2; // Use ReflectionOps to implement these methods. | 275 CODE_SIZE = 2; // Use ReflectionOps to implement these methods. |
335 LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. | 276 LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. |
336 } | 277 } |
337 optional OptimizeMode optimize_for = 9 [default=SPEED]; | 278 optional OptimizeMode optimize_for = 9 [default=SPEED]; |
338 | 279 |
339 // Sets the Go package where structs generated from this .proto will be | 280 // Sets the Go package where structs generated from this .proto will be |
340 // placed. If omitted, the Go package will be derived from the following: | 281 // placed. There is no default. |
341 // - The basename of the package import path, if provided. | |
342 // - Otherwise, the package statement in the .proto file, if present. | |
343 // - Otherwise, the basename of the .proto file, without extension. | |
344 optional string go_package = 11; | 282 optional string go_package = 11; |
345 | 283 |
346 | 284 |
347 | 285 |
348 // Should generic services be generated in each language? "Generic" services | 286 // Should generic services be generated in each language? "Generic" services |
349 // are not specific to any particular RPC system. They are generated by the | 287 // are not specific to any particular RPC system. They are generated by the |
350 // main code generators in each language (without additional plugins). | 288 // main code generators in each language (without additional plugins). |
351 // Generic services were the only kind of service generation supported by | 289 // Generic services were the only kind of service generation supported by |
352 // early versions of google.protobuf. | 290 // early versions of proto2. |
353 // | 291 // |
354 // Generic services are now considered deprecated in favor of using plugins | 292 // Generic services are now considered deprecated in favor of using plugins |
355 // that generate code specific to your particular RPC system. Therefore, | 293 // that generate code specific to your particular RPC system. Therefore, |
356 // these default to false. Old code which depends on generic services should | 294 // these default to false. Old code which depends on generic services should |
357 // explicitly set them to true. | 295 // explicitly set them to true. |
358 optional bool cc_generic_services = 16 [default=false]; | 296 optional bool cc_generic_services = 16 [default=false]; |
359 optional bool java_generic_services = 17 [default=false]; | 297 optional bool java_generic_services = 17 [default=false]; |
360 optional bool py_generic_services = 18 [default=false]; | 298 optional bool py_generic_services = 18 [default=false]; |
361 | 299 |
362 // Is this file deprecated? | |
363 // Depending on the target platform, this can emit Deprecated annotations | |
364 // for everything in the file, or it will be completely ignored; in the very | |
365 // least, this is a formalization for deprecating files. | |
366 optional bool deprecated = 23 [default=false]; | |
367 | |
368 // Enables the use of arenas for the proto messages in this file. This applies | |
369 // only to generated classes for C++. | |
370 optional bool cc_enable_arenas = 31 [default=false]; | |
371 | |
372 | |
373 // Sets the objective c class prefix which is prepended to all objective c | |
374 // generated classes from this .proto. There is no default. | |
375 optional string objc_class_prefix = 36; | |
376 | |
377 // Namespace for generated classes; defaults to the package. | |
378 optional string csharp_namespace = 37; | |
379 | |
380 // The parser stores options it doesn't recognize here. See above. | 300 // The parser stores options it doesn't recognize here. See above. |
381 repeated UninterpretedOption uninterpreted_option = 999; | 301 repeated UninterpretedOption uninterpreted_option = 999; |
382 | 302 |
383 // Clients can define custom options in extensions of this message. See above. | 303 // Clients can define custom options in extensions of this message. See above. |
384 extensions 1000 to max; | 304 extensions 1000 to max; |
385 | |
386 reserved 38; | |
387 } | 305 } |
388 | 306 |
389 message MessageOptions { | 307 message MessageOptions { |
390 // Set true to use the old proto1 MessageSet wire format for extensions. | 308 // Set true to use the old proto1 MessageSet wire format for extensions. |
391 // This is provided for backwards-compatibility with the MessageSet wire | 309 // This is provided for backwards-compatibility with the MessageSet wire |
392 // format. You should not use this for any other reason: It's less | 310 // format. You should not use this for any other reason: It's less |
393 // efficient, has fewer features, and is more complicated. | 311 // efficient, has fewer features, and is more complicated. |
394 // | 312 // |
395 // The message must be defined exactly as follows: | 313 // The message must be defined exactly as follows: |
396 // message Foo { | 314 // message Foo { |
397 // option message_set_wire_format = true; | 315 // option message_set_wire_format = true; |
398 // extensions 4 to max; | 316 // extensions 4 to max; |
399 // } | 317 // } |
400 // Note that the message cannot have any defined fields; MessageSets only | 318 // Note that the message cannot have any defined fields; MessageSets only |
401 // have extensions. | 319 // have extensions. |
402 // | 320 // |
403 // All extensions of your type must be singular messages; e.g. they cannot | 321 // All extensions of your type must be singular messages; e.g. they cannot |
404 // be int32s, enums, or repeated messages. | 322 // be int32s, enums, or repeated messages. |
405 // | 323 // |
406 // Because this is an option, the above two restrictions are not enforced by | 324 // Because this is an option, the above two restrictions are not enforced by |
407 // the protocol compiler. | 325 // the protocol compiler. |
408 optional bool message_set_wire_format = 1 [default=false]; | 326 optional bool message_set_wire_format = 1 [default=false]; |
409 | 327 |
410 // Disables the generation of the standard "descriptor()" accessor, which can | 328 // Disables the generation of the standard "descriptor()" accessor, which can |
411 // conflict with a field of the same name. This is meant to make migration | 329 // conflict with a field of the same name. This is meant to make migration |
412 // from proto1 easier; new code should avoid fields named "descriptor". | 330 // from proto1 easier; new code should avoid fields named "descriptor". |
413 optional bool no_standard_descriptor_accessor = 2 [default=false]; | 331 optional bool no_standard_descriptor_accessor = 2 [default=false]; |
414 | 332 |
415 // Is this message deprecated? | |
416 // Depending on the target platform, this can emit Deprecated annotations | |
417 // for the message, or it will be completely ignored; in the very least, | |
418 // this is a formalization for deprecating messages. | |
419 optional bool deprecated = 3 [default=false]; | |
420 | |
421 // Whether the message is an automatically generated map entry type for the | |
422 // maps field. | |
423 // | |
424 // For maps fields: | |
425 // map<KeyType, ValueType> map_field = 1; | |
426 // The parsed descriptor looks like: | |
427 // message MapFieldEntry { | |
428 // option map_entry = true; | |
429 // optional KeyType key = 1; | |
430 // optional ValueType value = 2; | |
431 // } | |
432 // repeated MapFieldEntry map_field = 1; | |
433 // | |
434 // Implementations may choose not to generate the map_entry=true message, but | |
435 // use a native map in the target language to hold the keys and values. | |
436 // The reflection APIs in such implementions still need to work as | |
437 // if the field is a repeated message field. | |
438 // | |
439 // NOTE: Do not set the option in .proto files. Always use the maps syntax | |
440 // instead. The option should only be implicitly set by the proto compiler | |
441 // parser. | |
442 optional bool map_entry = 7; | |
443 | |
444 // The parser stores options it doesn't recognize here. See above. | 333 // The parser stores options it doesn't recognize here. See above. |
445 repeated UninterpretedOption uninterpreted_option = 999; | 334 repeated UninterpretedOption uninterpreted_option = 999; |
446 | 335 |
447 // Clients can define custom options in extensions of this message. See above. | 336 // Clients can define custom options in extensions of this message. See above. |
448 extensions 1000 to max; | 337 extensions 1000 to max; |
449 } | 338 } |
450 | 339 |
451 message FieldOptions { | 340 message FieldOptions { |
452 // The ctype option instructs the C++ code generator to use a different | 341 // The ctype option instructs the C++ code generator to use a different |
453 // representation of the field than it normally would. See the specific | 342 // representation of the field than it normally would. See the specific |
454 // options below. This option is not yet implemented in the open source | 343 // options below. This option is not yet implemented in the open source |
455 // release -- sorry, we'll try to include it in a future version! | 344 // release -- sorry, we'll try to include it in a future version! |
456 optional CType ctype = 1 [default = STRING]; | 345 optional CType ctype = 1 [default = STRING]; |
457 enum CType { | 346 enum CType { |
458 // Default mode. | 347 // Default mode. |
459 STRING = 0; | 348 STRING = 0; |
460 | 349 |
461 CORD = 1; | 350 CORD = 1; |
462 | 351 |
463 STRING_PIECE = 2; | 352 STRING_PIECE = 2; |
464 } | 353 } |
465 // The packed option can be enabled for repeated primitive fields to enable | 354 // The packed option can be enabled for repeated primitive fields to enable |
466 // a more efficient representation on the wire. Rather than repeatedly | 355 // a more efficient representation on the wire. Rather than repeatedly |
467 // writing the tag and type for each element, the entire array is encoded as | 356 // writing the tag and type for each element, the entire array is encoded as |
468 // a single length-delimited blob. In proto3, only explicit setting it to | 357 // a single length-delimited blob. |
469 // false will avoid using packed encoding. | |
470 optional bool packed = 2; | 358 optional bool packed = 2; |
471 | 359 |
472 | 360 |
473 // The jstype option determines the JavaScript type used for values of the | |
474 // field. The option is permitted only for 64 bit integral and fixed types | |
475 // (int64, uint64, sint64, fixed64, sfixed64). By default these types are | |
476 // represented as JavaScript strings. This avoids loss of precision that can | |
477 // happen when a large value is converted to a floating point JavaScript | |
478 // numbers. Specifying JS_NUMBER for the jstype causes the generated | |
479 // JavaScript code to use the JavaScript "number" type instead of strings. | |
480 // This option is an enum to permit additional types to be added, | |
481 // e.g. goog.math.Integer. | |
482 optional JSType jstype = 6 [default = JS_NORMAL]; | |
483 enum JSType { | |
484 // Use the default type. | |
485 JS_NORMAL = 0; | |
486 | |
487 // Use JavaScript strings. | |
488 JS_STRING = 1; | |
489 | |
490 // Use JavaScript numbers. | |
491 JS_NUMBER = 2; | |
492 } | |
493 | 361 |
494 // Should this field be parsed lazily? Lazy applies only to message-type | 362 // Should this field be parsed lazily? Lazy applies only to message-type |
495 // fields. It means that when the outer message is initially parsed, the | 363 // fields. It means that when the outer message is initially parsed, the |
496 // inner message's contents will not be parsed but instead stored in encoded | 364 // inner message's contents will not be parsed but instead stored in encoded |
497 // form. The inner message will actually be parsed when it is first accessed. | 365 // form. The inner message will actually be parsed when it is first accessed. |
498 // | 366 // |
499 // This is only a hint. Implementations are free to choose whether to use | 367 // This is only a hint. Implementations are free to choose whether to use |
500 // eager or lazy parsing regardless of the value of this option. However, | 368 // eager or lazy parsing regardless of the value of this option. However, |
501 // setting this option true suggests that the protocol author believes that | 369 // setting this option true suggests that the protocol author believes that |
502 // using lazy parsing on this field is worth the additional bookkeeping | 370 // using lazy parsing on this field is worth the additional bookkeeping |
(...skipping 17 matching lines...) Expand all Loading... |
520 // check its required fields, regardless of whether or not the message has | 388 // check its required fields, regardless of whether or not the message has |
521 // been parsed. | 389 // been parsed. |
522 optional bool lazy = 5 [default=false]; | 390 optional bool lazy = 5 [default=false]; |
523 | 391 |
524 // Is this field deprecated? | 392 // Is this field deprecated? |
525 // Depending on the target platform, this can emit Deprecated annotations | 393 // Depending on the target platform, this can emit Deprecated annotations |
526 // for accessors, or it will be completely ignored; in the very least, this | 394 // for accessors, or it will be completely ignored; in the very least, this |
527 // is a formalization for deprecating fields. | 395 // is a formalization for deprecating fields. |
528 optional bool deprecated = 3 [default=false]; | 396 optional bool deprecated = 3 [default=false]; |
529 | 397 |
| 398 // EXPERIMENTAL. DO NOT USE. |
| 399 // For "map" fields, the name of the field in the enclosed type that |
| 400 // is the key for this map. For example, suppose we have: |
| 401 // message Item { |
| 402 // required string name = 1; |
| 403 // required string value = 2; |
| 404 // } |
| 405 // message Config { |
| 406 // repeated Item items = 1 [experimental_map_key="name"]; |
| 407 // } |
| 408 // In this situation, the map key for Item will be set to "name". |
| 409 // TODO: Fully-implement this, then remove the "experimental_" prefix. |
| 410 optional string experimental_map_key = 9; |
| 411 |
530 // For Google-internal migration only. Do not use. | 412 // For Google-internal migration only. Do not use. |
531 optional bool weak = 10 [default=false]; | 413 optional bool weak = 10 [default=false]; |
532 | 414 |
533 | |
534 // The parser stores options it doesn't recognize here. See above. | 415 // The parser stores options it doesn't recognize here. See above. |
535 repeated UninterpretedOption uninterpreted_option = 999; | 416 repeated UninterpretedOption uninterpreted_option = 999; |
536 | 417 |
537 // Clients can define custom options in extensions of this message. See above. | 418 // Clients can define custom options in extensions of this message. See above. |
538 extensions 1000 to max; | 419 extensions 1000 to max; |
539 } | 420 } |
540 | 421 |
541 message EnumOptions { | 422 message EnumOptions { |
542 | 423 |
543 // Set this option to true to allow mapping different tag names to the same | 424 // Set this option to false to disallow mapping different tag names to a same |
544 // value. | 425 // value. |
545 optional bool allow_alias = 2; | 426 optional bool allow_alias = 2 [default=true]; |
546 | |
547 // Is this enum deprecated? | |
548 // Depending on the target platform, this can emit Deprecated annotations | |
549 // for the enum, or it will be completely ignored; in the very least, this | |
550 // is a formalization for deprecating enums. | |
551 optional bool deprecated = 3 [default=false]; | |
552 | 427 |
553 // The parser stores options it doesn't recognize here. See above. | 428 // The parser stores options it doesn't recognize here. See above. |
554 repeated UninterpretedOption uninterpreted_option = 999; | 429 repeated UninterpretedOption uninterpreted_option = 999; |
555 | 430 |
556 // Clients can define custom options in extensions of this message. See above. | 431 // Clients can define custom options in extensions of this message. See above. |
557 extensions 1000 to max; | 432 extensions 1000 to max; |
558 } | 433 } |
559 | 434 |
560 message EnumValueOptions { | 435 message EnumValueOptions { |
561 // Is this enum value deprecated? | |
562 // Depending on the target platform, this can emit Deprecated annotations | |
563 // for the enum value, or it will be completely ignored; in the very least, | |
564 // this is a formalization for deprecating enum values. | |
565 optional bool deprecated = 1 [default=false]; | |
566 | |
567 // The parser stores options it doesn't recognize here. See above. | 436 // The parser stores options it doesn't recognize here. See above. |
568 repeated UninterpretedOption uninterpreted_option = 999; | 437 repeated UninterpretedOption uninterpreted_option = 999; |
569 | 438 |
570 // Clients can define custom options in extensions of this message. See above. | 439 // Clients can define custom options in extensions of this message. See above. |
571 extensions 1000 to max; | 440 extensions 1000 to max; |
572 } | 441 } |
573 | 442 |
574 message ServiceOptions { | 443 message ServiceOptions { |
575 | 444 |
576 // Note: Field numbers 1 through 32 are reserved for Google's internal RPC | 445 // Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
577 // framework. We apologize for hoarding these numbers to ourselves, but | 446 // framework. We apologize for hoarding these numbers to ourselves, but |
578 // we were already using them long before we decided to release Protocol | 447 // we were already using them long before we decided to release Protocol |
579 // Buffers. | 448 // Buffers. |
580 | 449 |
581 // Is this service deprecated? | |
582 // Depending on the target platform, this can emit Deprecated annotations | |
583 // for the service, or it will be completely ignored; in the very least, | |
584 // this is a formalization for deprecating services. | |
585 optional bool deprecated = 33 [default=false]; | |
586 | |
587 // The parser stores options it doesn't recognize here. See above. | 450 // The parser stores options it doesn't recognize here. See above. |
588 repeated UninterpretedOption uninterpreted_option = 999; | 451 repeated UninterpretedOption uninterpreted_option = 999; |
589 | 452 |
590 // Clients can define custom options in extensions of this message. See above. | 453 // Clients can define custom options in extensions of this message. See above. |
591 extensions 1000 to max; | 454 extensions 1000 to max; |
592 } | 455 } |
593 | 456 |
594 message MethodOptions { | 457 message MethodOptions { |
595 | 458 |
596 // Note: Field numbers 1 through 32 are reserved for Google's internal RPC | 459 // Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
597 // framework. We apologize for hoarding these numbers to ourselves, but | 460 // framework. We apologize for hoarding these numbers to ourselves, but |
598 // we were already using them long before we decided to release Protocol | 461 // we were already using them long before we decided to release Protocol |
599 // Buffers. | 462 // Buffers. |
600 | 463 |
601 // Is this method deprecated? | |
602 // Depending on the target platform, this can emit Deprecated annotations | |
603 // for the method, or it will be completely ignored; in the very least, | |
604 // this is a formalization for deprecating methods. | |
605 optional bool deprecated = 33 [default=false]; | |
606 | |
607 // The parser stores options it doesn't recognize here. See above. | 464 // The parser stores options it doesn't recognize here. See above. |
608 repeated UninterpretedOption uninterpreted_option = 999; | 465 repeated UninterpretedOption uninterpreted_option = 999; |
609 | 466 |
610 // Clients can define custom options in extensions of this message. See above. | 467 // Clients can define custom options in extensions of this message. See above. |
611 extensions 1000 to max; | 468 extensions 1000 to max; |
612 } | 469 } |
613 | 470 |
614 | 471 |
615 // A message representing a option the parser does not recognize. This only | 472 // A message representing a option the parser does not recognize. This only |
616 // appears in options protos created by the compiler::Parser class. | 473 // appears in options protos created by the compiler::Parser class. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 // 1 to each before displaying to a user. | 580 // 1 to each before displaying to a user. |
724 repeated int32 span = 2 [packed=true]; | 581 repeated int32 span = 2 [packed=true]; |
725 | 582 |
726 // If this SourceCodeInfo represents a complete declaration, these are any | 583 // If this SourceCodeInfo represents a complete declaration, these are any |
727 // comments appearing before and after the declaration which appear to be | 584 // comments appearing before and after the declaration which appear to be |
728 // attached to the declaration. | 585 // attached to the declaration. |
729 // | 586 // |
730 // A series of line comments appearing on consecutive lines, with no other | 587 // A series of line comments appearing on consecutive lines, with no other |
731 // tokens appearing on those lines, will be treated as a single comment. | 588 // tokens appearing on those lines, will be treated as a single comment. |
732 // | 589 // |
733 // leading_detached_comments will keep paragraphs of comments that appear | |
734 // before (but not connected to) the current element. Each paragraph, | |
735 // separated by empty lines, will be one comment element in the repeated | |
736 // field. | |
737 // | |
738 // Only the comment content is provided; comment markers (e.g. //) are | 590 // Only the comment content is provided; comment markers (e.g. //) are |
739 // stripped out. For block comments, leading whitespace and an asterisk | 591 // stripped out. For block comments, leading whitespace and an asterisk |
740 // will be stripped from the beginning of each line other than the first. | 592 // will be stripped from the beginning of each line other than the first. |
741 // Newlines are included in the output. | 593 // Newlines are included in the output. |
742 // | 594 // |
743 // Examples: | 595 // Examples: |
744 // | 596 // |
745 // optional int32 foo = 1; // Comment attached to foo. | 597 // optional int32 foo = 1; // Comment attached to foo. |
746 // // Comment attached to bar. | 598 // // Comment attached to bar. |
747 // optional int32 bar = 2; | 599 // optional int32 bar = 2; |
748 // | 600 // |
749 // optional string baz = 3; | 601 // optional string baz = 3; |
750 // // Comment attached to baz. | 602 // // Comment attached to baz. |
751 // // Another line attached to baz. | 603 // // Another line attached to baz. |
752 // | 604 // |
753 // // Comment attached to qux. | 605 // // Comment attached to qux. |
754 // // | 606 // // |
755 // // Another line attached to qux. | 607 // // Another line attached to qux. |
756 // optional double qux = 4; | 608 // optional double qux = 4; |
757 // | 609 // |
758 // // Detached comment for corge. This is not leading or trailing comments | |
759 // // to qux or corge because there are blank lines separating it from | |
760 // // both. | |
761 // | |
762 // // Detached comment for corge paragraph 2. | |
763 // | |
764 // optional string corge = 5; | 610 // optional string corge = 5; |
765 // /* Block comment attached | 611 // /* Block comment attached |
766 // * to corge. Leading asterisks | 612 // * to corge. Leading asterisks |
767 // * will be removed. */ | 613 // * will be removed. */ |
768 // /* Block comment attached to | 614 // /* Block comment attached to |
769 // * grault. */ | 615 // * grault. */ |
770 // optional int32 grault = 6; | 616 // optional int32 grault = 6; |
771 // | |
772 // // ignored detached comments. | |
773 optional string leading_comments = 3; | 617 optional string leading_comments = 3; |
774 optional string trailing_comments = 4; | 618 optional string trailing_comments = 4; |
775 repeated string leading_detached_comments = 6; | |
776 } | 619 } |
777 } | 620 } |
778 | |
779 // Describes the relationship between generated code and its original source | |
780 // file. A GeneratedCodeInfo message is associated with only one generated | |
781 // source file, but may contain references to different source .proto files. | |
782 message GeneratedCodeInfo { | |
783 // An Annotation connects some span of text in generated code to an element | |
784 // of its generating .proto file. | |
785 repeated Annotation annotation = 1; | |
786 message Annotation { | |
787 // Identifies the element in the original source .proto file. This field | |
788 // is formatted the same as SourceCodeInfo.Location.path. | |
789 repeated int32 path = 1 [packed=true]; | |
790 | |
791 // Identifies the filesystem path to the original source .proto. | |
792 optional string source_file = 2; | |
793 | |
794 // Identifies the starting offset in bytes in the generated code | |
795 // that relates to the identified object. | |
796 optional int32 begin = 3; | |
797 | |
798 // Identifies the ending offset in bytes in the generated code that | |
799 // relates to the identified offset. The end offset should be one past | |
800 // the last relevant byte (so the length of the text = end - begin). | |
801 optional int32 end = 4; | |
802 } | |
803 } | |
OLD | NEW |