github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/desc/protoprint/testfiles/descriptor-only-doc-comments.proto (about)

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