protobuf-cucumber 3.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.rubocop.yml +70 -0
  4. data/.rubocop_todo.yml +145 -0
  5. data/.travis.yml +40 -0
  6. data/.yardopts +5 -0
  7. data/CHANGES.md +344 -0
  8. data/CONTRIBUTING.md +16 -0
  9. data/Gemfile +3 -0
  10. data/LICENSE.txt +22 -0
  11. data/README.md +33 -0
  12. data/Rakefile +64 -0
  13. data/bin/protoc-gen-ruby +22 -0
  14. data/bin/rpc_server +5 -0
  15. data/install-protobuf.sh +28 -0
  16. data/lib/protobuf.rb +129 -0
  17. data/lib/protobuf/cli.rb +257 -0
  18. data/lib/protobuf/code_generator.rb +120 -0
  19. data/lib/protobuf/decoder.rb +28 -0
  20. data/lib/protobuf/deprecation.rb +117 -0
  21. data/lib/protobuf/descriptors.rb +3 -0
  22. data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +62 -0
  23. data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +301 -0
  24. data/lib/protobuf/encoder.rb +11 -0
  25. data/lib/protobuf/enum.rb +365 -0
  26. data/lib/protobuf/exceptions.rb +9 -0
  27. data/lib/protobuf/field.rb +74 -0
  28. data/lib/protobuf/field/base_field.rb +380 -0
  29. data/lib/protobuf/field/base_field_object_definitions.rb +504 -0
  30. data/lib/protobuf/field/bool_field.rb +64 -0
  31. data/lib/protobuf/field/bytes_field.rb +78 -0
  32. data/lib/protobuf/field/double_field.rb +25 -0
  33. data/lib/protobuf/field/enum_field.rb +61 -0
  34. data/lib/protobuf/field/field_array.rb +104 -0
  35. data/lib/protobuf/field/field_hash.rb +122 -0
  36. data/lib/protobuf/field/fixed32_field.rb +25 -0
  37. data/lib/protobuf/field/fixed64_field.rb +28 -0
  38. data/lib/protobuf/field/float_field.rb +43 -0
  39. data/lib/protobuf/field/int32_field.rb +21 -0
  40. data/lib/protobuf/field/int64_field.rb +34 -0
  41. data/lib/protobuf/field/integer_field.rb +23 -0
  42. data/lib/protobuf/field/message_field.rb +51 -0
  43. data/lib/protobuf/field/sfixed32_field.rb +27 -0
  44. data/lib/protobuf/field/sfixed64_field.rb +28 -0
  45. data/lib/protobuf/field/signed_integer_field.rb +29 -0
  46. data/lib/protobuf/field/sint32_field.rb +21 -0
  47. data/lib/protobuf/field/sint64_field.rb +21 -0
  48. data/lib/protobuf/field/string_field.rb +51 -0
  49. data/lib/protobuf/field/uint32_field.rb +21 -0
  50. data/lib/protobuf/field/uint64_field.rb +21 -0
  51. data/lib/protobuf/field/varint_field.rb +77 -0
  52. data/lib/protobuf/generators/base.rb +85 -0
  53. data/lib/protobuf/generators/enum_generator.rb +39 -0
  54. data/lib/protobuf/generators/extension_generator.rb +27 -0
  55. data/lib/protobuf/generators/field_generator.rb +193 -0
  56. data/lib/protobuf/generators/file_generator.rb +262 -0
  57. data/lib/protobuf/generators/group_generator.rb +122 -0
  58. data/lib/protobuf/generators/message_generator.rb +104 -0
  59. data/lib/protobuf/generators/option_generator.rb +17 -0
  60. data/lib/protobuf/generators/printable.rb +160 -0
  61. data/lib/protobuf/generators/service_generator.rb +50 -0
  62. data/lib/protobuf/lifecycle.rb +33 -0
  63. data/lib/protobuf/logging.rb +39 -0
  64. data/lib/protobuf/message.rb +260 -0
  65. data/lib/protobuf/message/fields.rb +233 -0
  66. data/lib/protobuf/message/serialization.rb +85 -0
  67. data/lib/protobuf/optionable.rb +70 -0
  68. data/lib/protobuf/rpc/buffer.rb +78 -0
  69. data/lib/protobuf/rpc/client.rb +140 -0
  70. data/lib/protobuf/rpc/connectors/base.rb +221 -0
  71. data/lib/protobuf/rpc/connectors/ping.rb +89 -0
  72. data/lib/protobuf/rpc/connectors/socket.rb +78 -0
  73. data/lib/protobuf/rpc/connectors/zmq.rb +319 -0
  74. data/lib/protobuf/rpc/dynamic_discovery.pb.rb +50 -0
  75. data/lib/protobuf/rpc/env.rb +60 -0
  76. data/lib/protobuf/rpc/error.rb +28 -0
  77. data/lib/protobuf/rpc/error/client_error.rb +31 -0
  78. data/lib/protobuf/rpc/error/server_error.rb +43 -0
  79. data/lib/protobuf/rpc/middleware.rb +25 -0
  80. data/lib/protobuf/rpc/middleware/exception_handler.rb +40 -0
  81. data/lib/protobuf/rpc/middleware/logger.rb +95 -0
  82. data/lib/protobuf/rpc/middleware/request_decoder.rb +79 -0
  83. data/lib/protobuf/rpc/middleware/response_encoder.rb +83 -0
  84. data/lib/protobuf/rpc/middleware/runner.rb +18 -0
  85. data/lib/protobuf/rpc/rpc.pb.rb +64 -0
  86. data/lib/protobuf/rpc/rpc_method.rb +16 -0
  87. data/lib/protobuf/rpc/server.rb +39 -0
  88. data/lib/protobuf/rpc/servers/socket/server.rb +121 -0
  89. data/lib/protobuf/rpc/servers/socket/worker.rb +56 -0
  90. data/lib/protobuf/rpc/servers/socket_runner.rb +46 -0
  91. data/lib/protobuf/rpc/servers/zmq/broker.rb +194 -0
  92. data/lib/protobuf/rpc/servers/zmq/server.rb +321 -0
  93. data/lib/protobuf/rpc/servers/zmq/util.rb +48 -0
  94. data/lib/protobuf/rpc/servers/zmq/worker.rb +105 -0
  95. data/lib/protobuf/rpc/servers/zmq_runner.rb +70 -0
  96. data/lib/protobuf/rpc/service.rb +172 -0
  97. data/lib/protobuf/rpc/service_directory.rb +261 -0
  98. data/lib/protobuf/rpc/service_dispatcher.rb +45 -0
  99. data/lib/protobuf/rpc/service_filters.rb +250 -0
  100. data/lib/protobuf/rpc/stat.rb +119 -0
  101. data/lib/protobuf/socket.rb +21 -0
  102. data/lib/protobuf/tasks.rb +1 -0
  103. data/lib/protobuf/tasks/compile.rake +80 -0
  104. data/lib/protobuf/varint.rb +20 -0
  105. data/lib/protobuf/varint_pure.rb +31 -0
  106. data/lib/protobuf/version.rb +3 -0
  107. data/lib/protobuf/wire_type.rb +10 -0
  108. data/lib/protobuf/zmq.rb +21 -0
  109. data/profile.html +5103 -0
  110. data/proto/dynamic_discovery.proto +44 -0
  111. data/proto/google/protobuf/compiler/plugin.proto +147 -0
  112. data/proto/google/protobuf/descriptor.proto +779 -0
  113. data/proto/rpc.proto +69 -0
  114. data/protobuf-cucumber.gemspec +57 -0
  115. data/spec/benchmark/tasks.rb +143 -0
  116. data/spec/bin/protoc-gen-ruby_spec.rb +23 -0
  117. data/spec/encoding/all_types_spec.rb +103 -0
  118. data/spec/encoding/extreme_values_spec.rb +0 -0
  119. data/spec/functional/class_inheritance_spec.rb +52 -0
  120. data/spec/functional/code_generator_spec.rb +58 -0
  121. data/spec/functional/socket_server_spec.rb +59 -0
  122. data/spec/functional/zmq_server_spec.rb +105 -0
  123. data/spec/lib/protobuf/cli_spec.rb +317 -0
  124. data/spec/lib/protobuf/code_generator_spec.rb +87 -0
  125. data/spec/lib/protobuf/enum_spec.rb +307 -0
  126. data/spec/lib/protobuf/field/bool_field_spec.rb +91 -0
  127. data/spec/lib/protobuf/field/double_field_spec.rb +9 -0
  128. data/spec/lib/protobuf/field/enum_field_spec.rb +44 -0
  129. data/spec/lib/protobuf/field/field_array_spec.rb +105 -0
  130. data/spec/lib/protobuf/field/field_hash_spec.rb +168 -0
  131. data/spec/lib/protobuf/field/fixed32_field_spec.rb +7 -0
  132. data/spec/lib/protobuf/field/fixed64_field_spec.rb +7 -0
  133. data/spec/lib/protobuf/field/float_field_spec.rb +90 -0
  134. data/spec/lib/protobuf/field/int32_field_spec.rb +120 -0
  135. data/spec/lib/protobuf/field/int64_field_spec.rb +7 -0
  136. data/spec/lib/protobuf/field/message_field_spec.rb +132 -0
  137. data/spec/lib/protobuf/field/sfixed32_field_spec.rb +9 -0
  138. data/spec/lib/protobuf/field/sfixed64_field_spec.rb +9 -0
  139. data/spec/lib/protobuf/field/sint32_field_spec.rb +9 -0
  140. data/spec/lib/protobuf/field/sint64_field_spec.rb +9 -0
  141. data/spec/lib/protobuf/field/string_field_spec.rb +79 -0
  142. data/spec/lib/protobuf/field/uint32_field_spec.rb +7 -0
  143. data/spec/lib/protobuf/field/uint64_field_spec.rb +7 -0
  144. data/spec/lib/protobuf/field_spec.rb +192 -0
  145. data/spec/lib/protobuf/generators/base_spec.rb +154 -0
  146. data/spec/lib/protobuf/generators/enum_generator_spec.rb +82 -0
  147. data/spec/lib/protobuf/generators/extension_generator_spec.rb +42 -0
  148. data/spec/lib/protobuf/generators/field_generator_spec.rb +197 -0
  149. data/spec/lib/protobuf/generators/file_generator_spec.rb +119 -0
  150. data/spec/lib/protobuf/generators/message_generator_spec.rb +0 -0
  151. data/spec/lib/protobuf/generators/service_generator_spec.rb +99 -0
  152. data/spec/lib/protobuf/lifecycle_spec.rb +94 -0
  153. data/spec/lib/protobuf/message_spec.rb +944 -0
  154. data/spec/lib/protobuf/optionable_spec.rb +265 -0
  155. data/spec/lib/protobuf/rpc/client_spec.rb +66 -0
  156. data/spec/lib/protobuf/rpc/connectors/base_spec.rb +226 -0
  157. data/spec/lib/protobuf/rpc/connectors/ping_spec.rb +69 -0
  158. data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +34 -0
  159. data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +110 -0
  160. data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +62 -0
  161. data/spec/lib/protobuf/rpc/middleware/logger_spec.rb +49 -0
  162. data/spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb +115 -0
  163. data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +91 -0
  164. data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +38 -0
  165. data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +43 -0
  166. data/spec/lib/protobuf/rpc/servers/zmq/util_spec.rb +55 -0
  167. data/spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb +35 -0
  168. data/spec/lib/protobuf/rpc/service_directory_spec.rb +293 -0
  169. data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +35 -0
  170. data/spec/lib/protobuf/rpc/service_filters_spec.rb +517 -0
  171. data/spec/lib/protobuf/rpc/service_spec.rb +162 -0
  172. data/spec/lib/protobuf/rpc/stat_spec.rb +101 -0
  173. data/spec/lib/protobuf/varint_spec.rb +29 -0
  174. data/spec/lib/protobuf_spec.rb +105 -0
  175. data/spec/spec_helper.rb +42 -0
  176. data/spec/support/all.rb +6 -0
  177. data/spec/support/packed_field.rb +23 -0
  178. data/spec/support/protos/all_types.data.bin +0 -0
  179. data/spec/support/protos/all_types.data.txt +119 -0
  180. data/spec/support/protos/enum.pb.rb +63 -0
  181. data/spec/support/protos/enum.proto +37 -0
  182. data/spec/support/protos/extreme_values.data.bin +0 -0
  183. data/spec/support/protos/google_unittest.bin +0 -0
  184. data/spec/support/protos/google_unittest.pb.rb +798 -0
  185. data/spec/support/protos/google_unittest.proto +884 -0
  186. data/spec/support/protos/google_unittest_custom_options.bin +0 -0
  187. data/spec/support/protos/google_unittest_custom_options.pb.rb +361 -0
  188. data/spec/support/protos/google_unittest_custom_options.proto +424 -0
  189. data/spec/support/protos/google_unittest_import.pb.rb +55 -0
  190. data/spec/support/protos/google_unittest_import.proto +73 -0
  191. data/spec/support/protos/google_unittest_import_public.pb.rb +31 -0
  192. data/spec/support/protos/google_unittest_import_public.proto +41 -0
  193. data/spec/support/protos/map-test.bin +157 -0
  194. data/spec/support/protos/map-test.pb.rb +85 -0
  195. data/spec/support/protos/map-test.proto +68 -0
  196. data/spec/support/protos/multi_field_extensions.pb.rb +59 -0
  197. data/spec/support/protos/multi_field_extensions.proto +35 -0
  198. data/spec/support/protos/resource.pb.rb +172 -0
  199. data/spec/support/protos/resource.proto +137 -0
  200. data/spec/support/resource_service.rb +23 -0
  201. data/spec/support/server.rb +65 -0
  202. data/spec/support/test_app_file.rb +2 -0
  203. data/varint_prof.rb +82 -0
  204. metadata +579 -0
@@ -0,0 +1,44 @@
1
+ // Copyright (c) 2013 MoneyDesktop, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+
21
+ // Authors: Devin Christensen
22
+ //
23
+ // Protobufs needed for dynamic discovery zmq server and client.
24
+
25
+ package protobuf.rpc.dynamicDiscovery;
26
+
27
+ enum BeaconType {
28
+ HEARTBEAT = 0;
29
+ FLATLINE = 1;
30
+ }
31
+
32
+ message Server {
33
+ optional string uuid = 1;
34
+ optional string address = 2;
35
+ optional string port = 3;
36
+ optional int32 ttl = 4;
37
+ repeated string services = 5;
38
+ }
39
+
40
+ message Beacon {
41
+ optional BeaconType beacon_type = 1;
42
+ optional Server server = 2;
43
+ }
44
+
@@ -0,0 +1,147 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // http://code.google.com/p/protobuf/
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
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ //
33
+ // WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
34
+ // change.
35
+ //
36
+ // protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
37
+ // just a program that reads a CodeGeneratorRequest from stdin and writes a
38
+ // CodeGeneratorResponse to stdout.
39
+ //
40
+ // Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
41
+ // of dealing with the raw protocol defined here.
42
+ //
43
+ // A plugin executable needs only to be placed somewhere in the path. The
44
+ // plugin should be named "protoc-gen-$NAME", and will then be used when the
45
+ // flag "--${NAME}_out" is passed to protoc.
46
+
47
+ package google.protobuf.compiler;
48
+ option java_package = "com.google.protobuf.compiler";
49
+ option java_outer_classname = "PluginProtos";
50
+
51
+ import "google/protobuf/descriptor.proto";
52
+
53
+ // An encoded CodeGeneratorRequest is written to the plugin's stdin.
54
+ message CodeGeneratorRequest {
55
+ // The .proto files that were explicitly listed on the command-line. The
56
+ // code generator should generate code only for these files. Each file's
57
+ // descriptor will be included in proto_file, below.
58
+ repeated string file_to_generate = 1;
59
+
60
+ // The generator parameter passed on the command-line.
61
+ optional string parameter = 2;
62
+
63
+ // FileDescriptorProtos for all files in files_to_generate and everything
64
+ // they import. The files will appear in topological order, so each file
65
+ // appears before any file that imports it.
66
+ //
67
+ // protoc guarantees that all proto_files will be written after
68
+ // the fields above, even though this is not technically guaranteed by the
69
+ // protobuf wire format. This theoretically could allow a plugin to stream
70
+ // in the FileDescriptorProtos and handle them one by one rather than read
71
+ // the entire set into memory at once. However, as of this writing, this
72
+ // is not similarly optimized on protoc's end -- it will store all fields in
73
+ // memory at once before sending them to the plugin.
74
+ repeated FileDescriptorProto proto_file = 15;
75
+ }
76
+
77
+ // The plugin writes an encoded CodeGeneratorResponse to stdout.
78
+ message CodeGeneratorResponse {
79
+ // Error message. If non-empty, code generation failed. The plugin process
80
+ // should exit with status code zero even if it reports an error in this way.
81
+ //
82
+ // This should be used to indicate errors in .proto files which prevent the
83
+ // code generator from generating correct code. Errors which indicate a
84
+ // problem in protoc itself -- such as the input CodeGeneratorRequest being
85
+ // unparseable -- should be reported by writing a message to stderr and
86
+ // exiting with a non-zero status code.
87
+ optional string error = 1;
88
+
89
+ // Represents a single generated file.
90
+ message File {
91
+ // The file name, relative to the output directory. The name must not
92
+ // contain "." or ".." components and must be relative, not be absolute (so,
93
+ // the file cannot lie outside the output directory). "/" must be used as
94
+ // the path separator, not "\".
95
+ //
96
+ // If the name is omitted, the content will be appended to the previous
97
+ // file. This allows the generator to break large files into small chunks,
98
+ // and allows the generated text to be streamed back to protoc so that large
99
+ // files need not reside completely in memory at one time. Note that as of
100
+ // this writing protoc does not optimize for this -- it will read the entire
101
+ // CodeGeneratorResponse before writing files to disk.
102
+ optional string name = 1;
103
+
104
+ // If non-empty, indicates that the named file should already exist, and the
105
+ // content here is to be inserted into that file at a defined insertion
106
+ // point. This feature allows a code generator to extend the output
107
+ // produced by another code generator. The original generator may provide
108
+ // insertion points by placing special annotations in the file that look
109
+ // like:
110
+ // @@protoc_insertion_point(NAME)
111
+ // The annotation can have arbitrary text before and after it on the line,
112
+ // which allows it to be placed in a comment. NAME should be replaced with
113
+ // an identifier naming the point -- this is what other generators will use
114
+ // as the insertion_point. Code inserted at this point will be placed
115
+ // immediately above the line containing the insertion point (thus multiple
116
+ // insertions to the same point will come out in the order they were added).
117
+ // The double-@ is intended to make it unlikely that the generated code
118
+ // could contain things that look like insertion points by accident.
119
+ //
120
+ // For example, the C++ code generator places the following line in the
121
+ // .pb.h files that it generates:
122
+ // // @@protoc_insertion_point(namespace_scope)
123
+ // This line appears within the scope of the file's package namespace, but
124
+ // outside of any particular class. Another plugin can then specify the
125
+ // insertion_point "namespace_scope" to generate additional classes or
126
+ // other declarations that should be placed in this scope.
127
+ //
128
+ // Note that if the line containing the insertion point begins with
129
+ // whitespace, the same whitespace will be added to every line of the
130
+ // inserted text. This is useful for languages like Python, where
131
+ // indentation matters. In these languages, the insertion point comment
132
+ // should be indented the same amount as any inserted code will need to be
133
+ // in order to work correctly in that context.
134
+ //
135
+ // The code generator that generates the initial file and the one which
136
+ // inserts into it must both run as part of a single invocation of protoc.
137
+ // Code generators are executed in the order in which they appear on the
138
+ // command line.
139
+ //
140
+ // If |insertion_point| is present, |name| must also be present.
141
+ optional string insertion_point = 2;
142
+
143
+ // The file contents.
144
+ optional string content = 15;
145
+ }
146
+ repeated File file = 15;
147
+ }
@@ -0,0 +1,779 @@
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
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // The messages in this file describe the definitions found in .proto files.
36
+ // A valid .proto file can be translated directly to a FileDescriptorProto
37
+ // without any other information (e.g. without reading its imports).
38
+
39
+
40
+ syntax = "proto2";
41
+
42
+ package google.protobuf;
43
+ option go_package = "descriptor";
44
+ option java_package = "com.google.protobuf";
45
+ option java_outer_classname = "DescriptorProtos";
46
+ option csharp_namespace = "Google.Protobuf.Reflection";
47
+ option objc_class_prefix = "GPB";
48
+
49
+ // descriptor.proto must be optimized for speed because reflection-based
50
+ // algorithms don't work during bootstrapping.
51
+ option optimize_for = SPEED;
52
+
53
+ // The protocol compiler can output a FileDescriptorSet containing the .proto
54
+ // files it parses.
55
+ message FileDescriptorSet {
56
+ repeated FileDescriptorProto file = 1;
57
+ }
58
+
59
+ // Describes a complete .proto file.
60
+ message FileDescriptorProto {
61
+ optional string name = 1; // file name, relative to root of source tree
62
+ optional string package = 2; // e.g. "foo", "foo.bar", etc.
63
+
64
+ // Names of files imported by this file.
65
+ repeated string dependency = 3;
66
+ // Indexes of the public imported files in the dependency list above.
67
+ repeated int32 public_dependency = 10;
68
+ // Indexes of the weak imported files in the dependency list.
69
+ // For Google-internal migration only. Do not use.
70
+ repeated int32 weak_dependency = 11;
71
+
72
+ // All top-level definitions in this file.
73
+ repeated DescriptorProto message_type = 4;
74
+ repeated EnumDescriptorProto enum_type = 5;
75
+ repeated ServiceDescriptorProto service = 6;
76
+ repeated FieldDescriptorProto extension = 7;
77
+
78
+ optional FileOptions options = 8;
79
+
80
+ // This field contains optional information about the original source code.
81
+ // You may safely remove this entire field without harming runtime
82
+ // functionality of the descriptors -- the information is needed only by
83
+ // development tools.
84
+ optional SourceCodeInfo source_code_info = 9;
85
+
86
+ // The syntax of the proto file.
87
+ // The supported values are "proto2" and "proto3".
88
+ optional string syntax = 12;
89
+ }
90
+
91
+ // Describes a message type.
92
+ message DescriptorProto {
93
+ optional string name = 1;
94
+
95
+ repeated FieldDescriptorProto field = 2;
96
+ repeated FieldDescriptorProto extension = 6;
97
+
98
+ repeated DescriptorProto nested_type = 3;
99
+ repeated EnumDescriptorProto enum_type = 4;
100
+
101
+ message ExtensionRange {
102
+ optional int32 start = 1;
103
+ optional int32 end = 2;
104
+ }
105
+ repeated ExtensionRange extension_range = 5;
106
+
107
+ repeated OneofDescriptorProto oneof_decl = 8;
108
+
109
+ optional MessageOptions options = 7;
110
+
111
+ // Range of reserved tag numbers. Reserved tag numbers may not be used by
112
+ // fields or extension ranges in the same message. Reserved ranges may
113
+ // not overlap.
114
+ message ReservedRange {
115
+ optional int32 start = 1; // Inclusive.
116
+ optional int32 end = 2; // Exclusive.
117
+ }
118
+ repeated ReservedRange reserved_range = 9;
119
+ // Reserved field names, which may not be used by fields in the same message.
120
+ // A given name may only be reserved once.
121
+ repeated string reserved_name = 10;
122
+ }
123
+
124
+ // Describes a field within a message.
125
+ message FieldDescriptorProto {
126
+ enum Type {
127
+ // 0 is reserved for errors.
128
+ // Order is weird for historical reasons.
129
+ TYPE_DOUBLE = 1;
130
+ TYPE_FLOAT = 2;
131
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
132
+ // negative values are likely.
133
+ TYPE_INT64 = 3;
134
+ TYPE_UINT64 = 4;
135
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
136
+ // negative values are likely.
137
+ TYPE_INT32 = 5;
138
+ TYPE_FIXED64 = 6;
139
+ TYPE_FIXED32 = 7;
140
+ TYPE_BOOL = 8;
141
+ TYPE_STRING = 9;
142
+ TYPE_GROUP = 10; // Tag-delimited aggregate.
143
+ TYPE_MESSAGE = 11; // Length-delimited aggregate.
144
+
145
+ // New in version 2.
146
+ TYPE_BYTES = 12;
147
+ TYPE_UINT32 = 13;
148
+ TYPE_ENUM = 14;
149
+ TYPE_SFIXED32 = 15;
150
+ TYPE_SFIXED64 = 16;
151
+ TYPE_SINT32 = 17; // Uses ZigZag encoding.
152
+ TYPE_SINT64 = 18; // Uses ZigZag encoding.
153
+ };
154
+
155
+ enum Label {
156
+ // 0 is reserved for errors
157
+ LABEL_OPTIONAL = 1;
158
+ LABEL_REQUIRED = 2;
159
+ LABEL_REPEATED = 3;
160
+ // TODO(sanjay): Should we add LABEL_MAP?
161
+ };
162
+
163
+ optional string name = 1;
164
+ optional int32 number = 3;
165
+ optional Label label = 4;
166
+
167
+ // If type_name is set, this need not be set. If both this and type_name
168
+ // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
169
+ optional Type type = 5;
170
+
171
+ // For message and enum types, this is the name of the type. If the name
172
+ // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
173
+ // rules are used to find the type (i.e. first the nested types within this
174
+ // message are searched, then within the parent, on up to the root
175
+ // namespace).
176
+ optional string type_name = 6;
177
+
178
+ // For extensions, this is the name of the type being extended. It is
179
+ // resolved in the same manner as type_name.
180
+ optional string extendee = 2;
181
+
182
+ // For numeric types, contains the original text representation of the value.
183
+ // For booleans, "true" or "false".
184
+ // For strings, contains the default text contents (not escaped in any way).
185
+ // For bytes, contains the C escaped value. All bytes >= 128 are escaped.
186
+ // TODO(kenton): Base-64 encode?
187
+ optional string default_value = 7;
188
+
189
+ // If set, gives the index of a oneof in the containing type's oneof_decl
190
+ // list. This field is a member of that oneof.
191
+ optional int32 oneof_index = 9;
192
+
193
+ // JSON name of this field. The value is set by protocol compiler. If the
194
+ // user has set a "json_name" option on this field, that option's value
195
+ // will be used. Otherwise, it's deduced from the field's name by converting
196
+ // it to camelCase.
197
+ optional string json_name = 10;
198
+
199
+ optional FieldOptions options = 8;
200
+ }
201
+
202
+ // Describes a oneof.
203
+ message OneofDescriptorProto {
204
+ optional string name = 1;
205
+ }
206
+
207
+ // Describes an enum type.
208
+ message EnumDescriptorProto {
209
+ optional string name = 1;
210
+
211
+ repeated EnumValueDescriptorProto value = 2;
212
+
213
+ optional EnumOptions options = 3;
214
+ }
215
+
216
+ // Describes a value within an enum.
217
+ message EnumValueDescriptorProto {
218
+ optional string name = 1;
219
+ optional int32 number = 2;
220
+
221
+ optional EnumValueOptions options = 3;
222
+ }
223
+
224
+ // Describes a service.
225
+ message ServiceDescriptorProto {
226
+ optional string name = 1;
227
+ repeated MethodDescriptorProto method = 2;
228
+
229
+ optional ServiceOptions options = 3;
230
+ }
231
+
232
+ // Describes a method of a service.
233
+ message MethodDescriptorProto {
234
+ optional string name = 1;
235
+
236
+ // Input and output type names. These are resolved in the same way as
237
+ // FieldDescriptorProto.type_name, but must refer to a message type.
238
+ optional string input_type = 2;
239
+ optional string output_type = 3;
240
+
241
+ optional MethodOptions options = 4;
242
+
243
+ // Identifies if client streams multiple client messages
244
+ optional bool client_streaming = 5 [default=false];
245
+ // Identifies if server streams multiple server messages
246
+ optional bool server_streaming = 6 [default=false];
247
+ }
248
+
249
+
250
+ // ===================================================================
251
+ // Options
252
+
253
+ // Each of the definitions above may have "options" attached. These are
254
+ // just annotations which may cause code to be generated slightly differently
255
+ // or may contain hints for code that manipulates protocol messages.
256
+ //
257
+ // Clients may define custom options as extensions of the *Options messages.
258
+ // These extensions may not yet be known at parsing time, so the parser cannot
259
+ // store the values in them. Instead it stores them in a field in the *Options
260
+ // message called uninterpreted_option. This field must have the same name
261
+ // across all *Options messages. We then use this field to populate the
262
+ // extensions when we build a descriptor, at which point all protos have been
263
+ // parsed and so all extensions are known.
264
+ //
265
+ // Extension numbers for custom options may be chosen as follows:
266
+ // * For options which will only be used within a single application or
267
+ // organization, or for experimental options, use field numbers 50000
268
+ // through 99999. It is up to you to ensure that you do not use the
269
+ // same number for multiple options.
270
+ // * For options which will be published and used publicly by multiple
271
+ // independent entities, e-mail protobuf-global-extension-registry@google.com
272
+ // to reserve extension numbers. Simply provide your project name (e.g.
273
+ // Objective-C plugin) and your project website (if available) -- there's no
274
+ // need to explain how you intend to use them. Usually you only need one
275
+ // extension number. You can declare multiple options with only one extension
276
+ // number by putting them in a sub-message. See the Custom Options section of
277
+ // the docs for examples:
278
+ // https://developers.google.com/protocol-buffers/docs/proto#options
279
+ // If this turns out to be popular, a web service will be set up
280
+ // to automatically assign option numbers.
281
+
282
+
283
+ message FileOptions {
284
+
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
+
291
+
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;
298
+
299
+ // If set true, then the Java code generator will generate a separate .java
300
+ // file for each top-level message, enum, and service defined in the .proto
301
+ // file. Thus, these types will *not* be nested inside the outer class
302
+ // named by java_outer_classname. However, the outer class will still be
303
+ // generated to contain the file's getDescriptor() method as well as any
304
+ // top-level extensions defined in the file.
305
+ optional bool java_multiple_files = 10 [default=false];
306
+
307
+ // If set true, then the Java code generator will generate equals() and
308
+ // hashCode() methods for all messages defined in the .proto file.
309
+ // This increases generated code size, potentially substantially for large
310
+ // protos, which may harm a memory-constrained application.
311
+ // - In the full runtime this is a speed optimization, as the
312
+ // AbstractMessage base class includes reflection-based implementations of
313
+ // these methods.
314
+ // - In the lite runtime, setting this option changes the semantics of
315
+ // equals() and hashCode() to more closely match those of the full runtime;
316
+ // the generated methods compute their results based on field values rather
317
+ // than object identity. (Implementations should not assume that hashcodes
318
+ // will be consistent across runtimes or versions of the protocol compiler.)
319
+ optional bool java_generate_equals_and_hash = 20 [default=false];
320
+
321
+ // If set true, then the Java2 code generator will generate code that
322
+ // throws an exception whenever an attempt is made to assign a non-UTF-8
323
+ // byte sequence to a string field.
324
+ // Message reflection will do the same.
325
+ // However, an extension field still accepts non-UTF-8 byte sequences.
326
+ // This option has no effect on when used with the lite runtime.
327
+ optional bool java_string_check_utf8 = 27 [default=false];
328
+
329
+
330
+ // Generated classes can be optimized for speed or code size.
331
+ enum OptimizeMode {
332
+ SPEED = 1; // Generate complete code for parsing, serialization,
333
+ // etc.
334
+ CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
335
+ LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
336
+ }
337
+ optional OptimizeMode optimize_for = 9 [default=SPEED];
338
+
339
+ // Sets the Go package where structs generated from this .proto will be
340
+ // placed. If omitted, the Go package will be derived from the following:
341
+ // - The basename of the package import path, if provided.
342
+ // - Otherwise, the package statement in the .proto file, if present.
343
+ // - Otherwise, the basename of the .proto file, without extension.
344
+ optional string go_package = 11;
345
+
346
+
347
+
348
+ // Should generic services be generated in each language? "Generic" services
349
+ // are not specific to any particular RPC system. They are generated by the
350
+ // main code generators in each language (without additional plugins).
351
+ // Generic services were the only kind of service generation supported by
352
+ // early versions of google.protobuf.
353
+ //
354
+ // Generic services are now considered deprecated in favor of using plugins
355
+ // that generate code specific to your particular RPC system. Therefore,
356
+ // these default to false. Old code which depends on generic services should
357
+ // explicitly set them to true.
358
+ optional bool cc_generic_services = 16 [default=false];
359
+ optional bool java_generic_services = 17 [default=false];
360
+ optional bool py_generic_services = 18 [default=false];
361
+
362
+ // Is this file deprecated?
363
+ // Depending on the target platform, this can emit Deprecated annotations
364
+ // for everything in the file, or it will be completely ignored; in the very
365
+ // least, this is a formalization for deprecating files.
366
+ optional bool deprecated = 23 [default=false];
367
+
368
+ // Enables the use of arenas for the proto messages in this file. This applies
369
+ // only to generated classes for C++.
370
+ optional bool cc_enable_arenas = 31 [default=false];
371
+
372
+
373
+ // Sets the objective c class prefix which is prepended to all objective c
374
+ // generated classes from this .proto. There is no default.
375
+ optional string objc_class_prefix = 36;
376
+
377
+ // Namespace for generated classes; defaults to the package.
378
+ optional string csharp_namespace = 37;
379
+
380
+ // Whether the nano proto compiler should generate in the deprecated non-nano
381
+ // suffixed package.
382
+ optional bool javanano_use_deprecated_package = 38;
383
+
384
+ // The parser stores options it doesn't recognize here. See above.
385
+ repeated UninterpretedOption uninterpreted_option = 999;
386
+
387
+ // Clients can define custom options in extensions of this message. See above.
388
+ extensions 1000 to max;
389
+ }
390
+
391
+ message MessageOptions {
392
+ // Set true to use the old proto1 MessageSet wire format for extensions.
393
+ // This is provided for backwards-compatibility with the MessageSet wire
394
+ // format. You should not use this for any other reason: It's less
395
+ // efficient, has fewer features, and is more complicated.
396
+ //
397
+ // The message must be defined exactly as follows:
398
+ // message Foo {
399
+ // option message_set_wire_format = true;
400
+ // extensions 4 to max;
401
+ // }
402
+ // Note that the message cannot have any defined fields; MessageSets only
403
+ // have extensions.
404
+ //
405
+ // All extensions of your type must be singular messages; e.g. they cannot
406
+ // be int32s, enums, or repeated messages.
407
+ //
408
+ // Because this is an option, the above two restrictions are not enforced by
409
+ // the protocol compiler.
410
+ optional bool message_set_wire_format = 1 [default=false];
411
+
412
+ // Disables the generation of the standard "descriptor()" accessor, which can
413
+ // conflict with a field of the same name. This is meant to make migration
414
+ // from proto1 easier; new code should avoid fields named "descriptor".
415
+ optional bool no_standard_descriptor_accessor = 2 [default=false];
416
+
417
+ // Is this message deprecated?
418
+ // Depending on the target platform, this can emit Deprecated annotations
419
+ // for the message, or it will be completely ignored; in the very least,
420
+ // this is a formalization for deprecating messages.
421
+ optional bool deprecated = 3 [default=false];
422
+
423
+ // Whether the message is an automatically generated map entry type for the
424
+ // maps field.
425
+ //
426
+ // For maps fields:
427
+ // map<KeyType, ValueType> map_field = 1;
428
+ // The parsed descriptor looks like:
429
+ // message MapFieldEntry {
430
+ // option map_entry = true;
431
+ // optional KeyType key = 1;
432
+ // optional ValueType value = 2;
433
+ // }
434
+ // repeated MapFieldEntry map_field = 1;
435
+ //
436
+ // Implementations may choose not to generate the map_entry=true message, but
437
+ // use a native map in the target language to hold the keys and values.
438
+ // The reflection APIs in such implementions still need to work as
439
+ // if the field is a repeated message field.
440
+ //
441
+ // NOTE: Do not set the option in .proto files. Always use the maps syntax
442
+ // instead. The option should only be implicitly set by the proto compiler
443
+ // parser.
444
+ optional bool map_entry = 7;
445
+
446
+ // The parser stores options it doesn't recognize here. See above.
447
+ repeated UninterpretedOption uninterpreted_option = 999;
448
+
449
+ // Clients can define custom options in extensions of this message. See above.
450
+ extensions 1000 to max;
451
+ }
452
+
453
+ message FieldOptions {
454
+ // The ctype option instructs the C++ code generator to use a different
455
+ // representation of the field than it normally would. See the specific
456
+ // options below. This option is not yet implemented in the open source
457
+ // release -- sorry, we'll try to include it in a future version!
458
+ optional CType ctype = 1 [default = STRING];
459
+ enum CType {
460
+ // Default mode.
461
+ STRING = 0;
462
+
463
+ CORD = 1;
464
+
465
+ STRING_PIECE = 2;
466
+ }
467
+ // The packed option can be enabled for repeated primitive fields to enable
468
+ // a more efficient representation on the wire. Rather than repeatedly
469
+ // writing the tag and type for each element, the entire array is encoded as
470
+ // a single length-delimited blob. In proto3, only explicit setting it to
471
+ // false will avoid using packed encoding.
472
+ optional bool packed = 2;
473
+
474
+
475
+ // The jstype option determines the JavaScript type used for values of the
476
+ // field. The option is permitted only for 64 bit integral and fixed types
477
+ // (int64, uint64, sint64, fixed64, sfixed64). By default these types are
478
+ // represented as JavaScript strings. This avoids loss of precision that can
479
+ // happen when a large value is converted to a floating point JavaScript
480
+ // numbers. Specifying JS_NUMBER for the jstype causes the generated
481
+ // JavaScript code to use the JavaScript "number" type instead of strings.
482
+ // This option is an enum to permit additional types to be added,
483
+ // e.g. goog.math.Integer.
484
+ optional JSType jstype = 6 [default = JS_NORMAL];
485
+ enum JSType {
486
+ // Use the default type.
487
+ JS_NORMAL = 0;
488
+
489
+ // Use JavaScript strings.
490
+ JS_STRING = 1;
491
+
492
+ // Use JavaScript numbers.
493
+ JS_NUMBER = 2;
494
+ }
495
+
496
+ // Should this field be parsed lazily? Lazy applies only to message-type
497
+ // fields. It means that when the outer message is initially parsed, the
498
+ // inner message's contents will not be parsed but instead stored in encoded
499
+ // form. The inner message will actually be parsed when it is first accessed.
500
+ //
501
+ // This is only a hint. Implementations are free to choose whether to use
502
+ // eager or lazy parsing regardless of the value of this option. However,
503
+ // setting this option true suggests that the protocol author believes that
504
+ // using lazy parsing on this field is worth the additional bookkeeping
505
+ // overhead typically needed to implement it.
506
+ //
507
+ // This option does not affect the public interface of any generated code;
508
+ // all method signatures remain the same. Furthermore, thread-safety of the
509
+ // interface is not affected by this option; const methods remain safe to
510
+ // call from multiple threads concurrently, while non-const methods continue
511
+ // to require exclusive access.
512
+ //
513
+ //
514
+ // Note that implementations may choose not to check required fields within
515
+ // a lazy sub-message. That is, calling IsInitialized() on the outher message
516
+ // may return true even if the inner message has missing required fields.
517
+ // This is necessary because otherwise the inner message would have to be
518
+ // parsed in order to perform the check, defeating the purpose of lazy
519
+ // parsing. An implementation which chooses not to check required fields
520
+ // must be consistent about it. That is, for any particular sub-message, the
521
+ // implementation must either *always* check its required fields, or *never*
522
+ // check its required fields, regardless of whether or not the message has
523
+ // been parsed.
524
+ optional bool lazy = 5 [default=false];
525
+
526
+ // Is this field deprecated?
527
+ // Depending on the target platform, this can emit Deprecated annotations
528
+ // for accessors, or it will be completely ignored; in the very least, this
529
+ // is a formalization for deprecating fields.
530
+ optional bool deprecated = 3 [default=false];
531
+
532
+ // For Google-internal migration only. Do not use.
533
+ optional bool weak = 10 [default=false];
534
+
535
+
536
+ // The parser stores options it doesn't recognize here. See above.
537
+ repeated UninterpretedOption uninterpreted_option = 999;
538
+
539
+ // Clients can define custom options in extensions of this message. See above.
540
+ extensions 1000 to max;
541
+ }
542
+
543
+ message EnumOptions {
544
+
545
+ // Set this option to true to allow mapping different tag names to the same
546
+ // value.
547
+ optional bool allow_alias = 2;
548
+
549
+ // Is this enum deprecated?
550
+ // Depending on the target platform, this can emit Deprecated annotations
551
+ // for the enum, or it will be completely ignored; in the very least, this
552
+ // is a formalization for deprecating enums.
553
+ optional bool deprecated = 3 [default=false];
554
+
555
+ // The parser stores options it doesn't recognize here. See above.
556
+ repeated UninterpretedOption uninterpreted_option = 999;
557
+
558
+ // Clients can define custom options in extensions of this message. See above.
559
+ extensions 1000 to max;
560
+ }
561
+
562
+ message EnumValueOptions {
563
+ // Is this enum value deprecated?
564
+ // Depending on the target platform, this can emit Deprecated annotations
565
+ // for the enum value, or it will be completely ignored; in the very least,
566
+ // this is a formalization for deprecating enum values.
567
+ optional bool deprecated = 1 [default=false];
568
+
569
+ // The parser stores options it doesn't recognize here. See above.
570
+ repeated UninterpretedOption uninterpreted_option = 999;
571
+
572
+ // Clients can define custom options in extensions of this message. See above.
573
+ extensions 1000 to max;
574
+ }
575
+
576
+ message ServiceOptions {
577
+
578
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
579
+ // framework. We apologize for hoarding these numbers to ourselves, but
580
+ // we were already using them long before we decided to release Protocol
581
+ // Buffers.
582
+
583
+ // Is this service deprecated?
584
+ // Depending on the target platform, this can emit Deprecated annotations
585
+ // for the service, or it will be completely ignored; in the very least,
586
+ // this is a formalization for deprecating services.
587
+ optional bool deprecated = 33 [default=false];
588
+
589
+ // The parser stores options it doesn't recognize here. See above.
590
+ repeated UninterpretedOption uninterpreted_option = 999;
591
+
592
+ // Clients can define custom options in extensions of this message. See above.
593
+ extensions 1000 to max;
594
+ }
595
+
596
+ message MethodOptions {
597
+
598
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
599
+ // framework. We apologize for hoarding these numbers to ourselves, but
600
+ // we were already using them long before we decided to release Protocol
601
+ // Buffers.
602
+
603
+ // Is this method deprecated?
604
+ // Depending on the target platform, this can emit Deprecated annotations
605
+ // for the method, or it will be completely ignored; in the very least,
606
+ // this is a formalization for deprecating methods.
607
+ optional bool deprecated = 33 [default=false];
608
+
609
+ // The parser stores options it doesn't recognize here. See above.
610
+ repeated UninterpretedOption uninterpreted_option = 999;
611
+
612
+ // Clients can define custom options in extensions of this message. See above.
613
+ extensions 1000 to max;
614
+ }
615
+
616
+
617
+ // A message representing a option the parser does not recognize. This only
618
+ // appears in options protos created by the compiler::Parser class.
619
+ // DescriptorPool resolves these when building Descriptor objects. Therefore,
620
+ // options protos in descriptor objects (e.g. returned by Descriptor::options(),
621
+ // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
622
+ // in them.
623
+ message UninterpretedOption {
624
+ // The name of the uninterpreted option. Each string represents a segment in
625
+ // a dot-separated name. is_extension is true iff a segment represents an
626
+ // extension (denoted with parentheses in options specs in .proto files).
627
+ // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
628
+ // "foo.(bar.baz).qux".
629
+ message NamePart {
630
+ required string name_part = 1;
631
+ required bool is_extension = 2;
632
+ }
633
+ repeated NamePart name = 2;
634
+
635
+ // The value of the uninterpreted option, in whatever type the tokenizer
636
+ // identified it as during parsing. Exactly one of these should be set.
637
+ optional string identifier_value = 3;
638
+ optional uint64 positive_int_value = 4;
639
+ optional int64 negative_int_value = 5;
640
+ optional double double_value = 6;
641
+ optional bytes string_value = 7;
642
+ optional string aggregate_value = 8;
643
+ }
644
+
645
+ // ===================================================================
646
+ // Optional source code info
647
+
648
+ // Encapsulates information about the original source file from which a
649
+ // FileDescriptorProto was generated.
650
+ message SourceCodeInfo {
651
+ // A Location identifies a piece of source code in a .proto file which
652
+ // corresponds to a particular definition. This information is intended
653
+ // to be useful to IDEs, code indexers, documentation generators, and similar
654
+ // tools.
655
+ //
656
+ // For example, say we have a file like:
657
+ // message Foo {
658
+ // optional string foo = 1;
659
+ // }
660
+ // Let's look at just the field definition:
661
+ // optional string foo = 1;
662
+ // ^ ^^ ^^ ^ ^^^
663
+ // a bc de f ghi
664
+ // We have the following locations:
665
+ // span path represents
666
+ // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
667
+ // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
668
+ // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
669
+ // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
670
+ // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
671
+ //
672
+ // Notes:
673
+ // - A location may refer to a repeated field itself (i.e. not to any
674
+ // particular index within it). This is used whenever a set of elements are
675
+ // logically enclosed in a single code segment. For example, an entire
676
+ // extend block (possibly containing multiple extension definitions) will
677
+ // have an outer location whose path refers to the "extensions" repeated
678
+ // field without an index.
679
+ // - Multiple locations may have the same path. This happens when a single
680
+ // logical declaration is spread out across multiple places. The most
681
+ // obvious example is the "extend" block again -- there may be multiple
682
+ // extend blocks in the same scope, each of which will have the same path.
683
+ // - A location's span is not always a subset of its parent's span. For
684
+ // example, the "extendee" of an extension declaration appears at the
685
+ // beginning of the "extend" block and is shared by all extensions within
686
+ // the block.
687
+ // - Just because a location's span is a subset of some other location's span
688
+ // does not mean that it is a descendent. For example, a "group" defines
689
+ // both a type and a field in a single declaration. Thus, the locations
690
+ // corresponding to the type and field and their components will overlap.
691
+ // - Code which tries to interpret locations should probably be designed to
692
+ // ignore those that it doesn't understand, as more types of locations could
693
+ // be recorded in the future.
694
+ repeated Location location = 1;
695
+ message Location {
696
+ // Identifies which part of the FileDescriptorProto was defined at this
697
+ // location.
698
+ //
699
+ // Each element is a field number or an index. They form a path from
700
+ // the root FileDescriptorProto to the place where the definition. For
701
+ // example, this path:
702
+ // [ 4, 3, 2, 7, 1 ]
703
+ // refers to:
704
+ // file.message_type(3) // 4, 3
705
+ // .field(7) // 2, 7
706
+ // .name() // 1
707
+ // This is because FileDescriptorProto.message_type has field number 4:
708
+ // repeated DescriptorProto message_type = 4;
709
+ // and DescriptorProto.field has field number 2:
710
+ // repeated FieldDescriptorProto field = 2;
711
+ // and FieldDescriptorProto.name has field number 1:
712
+ // optional string name = 1;
713
+ //
714
+ // Thus, the above path gives the location of a field name. If we removed
715
+ // the last element:
716
+ // [ 4, 3, 2, 7 ]
717
+ // this path refers to the whole field declaration (from the beginning
718
+ // of the label to the terminating semicolon).
719
+ repeated int32 path = 1 [packed=true];
720
+
721
+ // Always has exactly three or four elements: start line, start column,
722
+ // end line (optional, otherwise assumed same as start line), end column.
723
+ // These are packed into a single field for efficiency. Note that line
724
+ // and column numbers are zero-based -- typically you will want to add
725
+ // 1 to each before displaying to a user.
726
+ repeated int32 span = 2 [packed=true];
727
+
728
+ // If this SourceCodeInfo represents a complete declaration, these are any
729
+ // comments appearing before and after the declaration which appear to be
730
+ // attached to the declaration.
731
+ //
732
+ // A series of line comments appearing on consecutive lines, with no other
733
+ // tokens appearing on those lines, will be treated as a single comment.
734
+ //
735
+ // leading_detached_comments will keep paragraphs of comments that appear
736
+ // before (but not connected to) the current element. Each paragraph,
737
+ // separated by empty lines, will be one comment element in the repeated
738
+ // field.
739
+ //
740
+ // Only the comment content is provided; comment markers (e.g. //) are
741
+ // stripped out. For block comments, leading whitespace and an asterisk
742
+ // will be stripped from the beginning of each line other than the first.
743
+ // Newlines are included in the output.
744
+ //
745
+ // Examples:
746
+ //
747
+ // optional int32 foo = 1; // Comment attached to foo.
748
+ // // Comment attached to bar.
749
+ // optional int32 bar = 2;
750
+ //
751
+ // optional string baz = 3;
752
+ // // Comment attached to baz.
753
+ // // Another line attached to baz.
754
+ //
755
+ // // Comment attached to qux.
756
+ // //
757
+ // // Another line attached to qux.
758
+ // optional double qux = 4;
759
+ //
760
+ // // Detached comment for corge. This is not leading or trailing comments
761
+ // // to qux or corge because there are blank lines separating it from
762
+ // // both.
763
+ //
764
+ // // Detached comment for corge paragraph 2.
765
+ //
766
+ // optional string corge = 5;
767
+ // /* Block comment attached
768
+ // * to corge. Leading asterisks
769
+ // * will be removed. */
770
+ // /* Block comment attached to
771
+ // * grault. */
772
+ // optional int32 grault = 6;
773
+ //
774
+ // // ignored detached comments.
775
+ optional string leading_comments = 3;
776
+ optional string trailing_comments = 4;
777
+ repeated string leading_detached_comments = 6;
778
+ }
779
+ }