descriptor.proto 37 KB

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