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