github.com/syumai/protoreflect@v1.7.1-0.20200810020253-2ac7e3b3a321/desc/protoprint/testfiles/descriptor-sorted.proto (about)

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