descriptor_sv.proto 38 KB

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