descriptor.proto 32 KB

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