protobuf-core 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +23 -0
- data/Rakefile +5 -0
- data/bin/protoc-gen-ruby +16 -0
- data/lib/protobuf.rb +27 -0
- data/lib/protobuf/code_generator.rb +44 -0
- data/lib/protobuf/core.rb +2 -0
- data/lib/protobuf/core/version.rb +5 -0
- data/lib/protobuf/decoder.rb +73 -0
- data/lib/protobuf/deprecation.rb +112 -0
- data/lib/protobuf/descriptors.rb +3 -0
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +54 -0
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +251 -0
- data/lib/protobuf/encoder.rb +67 -0
- data/lib/protobuf/enum.rb +303 -0
- data/lib/protobuf/exceptions.rb +9 -0
- data/lib/protobuf/field.rb +74 -0
- data/lib/protobuf/field/base_field.rb +267 -0
- data/lib/protobuf/field/bool_field.rb +59 -0
- data/lib/protobuf/field/bytes_field.rb +82 -0
- data/lib/protobuf/field/double_field.rb +25 -0
- data/lib/protobuf/field/enum_field.rb +68 -0
- data/lib/protobuf/field/field_array.rb +87 -0
- data/lib/protobuf/field/fixed32_field.rb +25 -0
- data/lib/protobuf/field/fixed64_field.rb +28 -0
- data/lib/protobuf/field/float_field.rb +41 -0
- data/lib/protobuf/field/int32_field.rb +21 -0
- data/lib/protobuf/field/int64_field.rb +21 -0
- data/lib/protobuf/field/integer_field.rb +23 -0
- data/lib/protobuf/field/message_field.rb +65 -0
- data/lib/protobuf/field/sfixed32_field.rb +27 -0
- data/lib/protobuf/field/sfixed64_field.rb +28 -0
- data/lib/protobuf/field/signed_integer_field.rb +29 -0
- data/lib/protobuf/field/sint32_field.rb +21 -0
- data/lib/protobuf/field/sint64_field.rb +21 -0
- data/lib/protobuf/field/string_field.rb +34 -0
- data/lib/protobuf/field/uint32_field.rb +21 -0
- data/lib/protobuf/field/uint64_field.rb +21 -0
- data/lib/protobuf/field/varint_field.rb +73 -0
- data/lib/protobuf/generators/base.rb +70 -0
- data/lib/protobuf/generators/enum_generator.rb +41 -0
- data/lib/protobuf/generators/extension_generator.rb +27 -0
- data/lib/protobuf/generators/field_generator.rb +131 -0
- data/lib/protobuf/generators/file_generator.rb +132 -0
- data/lib/protobuf/generators/group_generator.rb +105 -0
- data/lib/protobuf/generators/message_generator.rb +98 -0
- data/lib/protobuf/generators/printable.rb +160 -0
- data/lib/protobuf/logging.rb +39 -0
- data/lib/protobuf/message.rb +193 -0
- data/lib/protobuf/message/fields.rb +133 -0
- data/lib/protobuf/message/serialization.rb +89 -0
- data/lib/protobuf/optionable.rb +23 -0
- data/lib/protobuf/wire_type.rb +10 -0
- data/proto/dynamic_discovery.proto +44 -0
- data/proto/google/protobuf/compiler/plugin.proto +147 -0
- data/proto/google/protobuf/descriptor.proto +620 -0
- data/proto/rpc.proto +62 -0
- data/protobuf-core.gemspec +31 -0
- data/spec/bin/protoc-gen-ruby_spec.rb +23 -0
- data/spec/data/data.bin +3 -0
- data/spec/data/types.bin +0 -0
- data/spec/encoding/all_types_spec.rb +105 -0
- data/spec/encoding/extreme_values_spec.rb +0 -0
- data/spec/functional/class_inheritance_spec.rb +52 -0
- data/spec/functional/compile_and_require_spec.rb +29 -0
- data/spec/lib/protobuf/base_spec.rb +84 -0
- data/spec/lib/protobuf/code_generator_spec.rb +60 -0
- data/spec/lib/protobuf/enum_generator_spec.rb +73 -0
- data/spec/lib/protobuf/enum_spec.rb +265 -0
- data/spec/lib/protobuf/extension_generator_spec.rb +42 -0
- data/spec/lib/protobuf/field/bool_field_spec.rb +51 -0
- data/spec/lib/protobuf/field/field_array_spec.rb +69 -0
- data/spec/lib/protobuf/field/float_field_spec.rb +55 -0
- data/spec/lib/protobuf/field/int32_field_spec.rb +90 -0
- data/spec/lib/protobuf/field/string_field_spec.rb +45 -0
- data/spec/lib/protobuf/field_generator_spec.rb +102 -0
- data/spec/lib/protobuf/field_spec.rb +191 -0
- data/spec/lib/protobuf/file_generator_spec.rb +32 -0
- data/spec/lib/protobuf/message_generator_spec.rb +0 -0
- data/spec/lib/protobuf/message_spec.rb +526 -0
- data/spec/lib/protobuf/optionable_spec.rb +46 -0
- data/spec/lib/protobuf_spec.rb +45 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/support/packed_field.rb +22 -0
- data/spec/support/test/all_types.data.bin +0 -0
- data/spec/support/test/all_types.data.txt +119 -0
- data/spec/support/test/bacon.proto +14 -0
- data/spec/support/test/defaults.pb.rb +27 -0
- data/spec/support/test/defaults.proto +9 -0
- data/spec/support/test/enum.pb.rb +61 -0
- data/spec/support/test/enum.proto +34 -0
- data/spec/support/test/extended.pb.rb +24 -0
- data/spec/support/test/extended.proto +10 -0
- data/spec/support/test/extreme_values.data.bin +0 -0
- data/spec/support/test/google_unittest.pb.rb +530 -0
- data/spec/support/test/google_unittest.proto +713 -0
- data/spec/support/test/google_unittest_import.pb.rb +39 -0
- data/spec/support/test/google_unittest_import.proto +64 -0
- data/spec/support/test/google_unittest_import_public.pb.rb +10 -0
- data/spec/support/test/google_unittest_import_public.proto +38 -0
- data/spec/support/test/multi_field_extensions.pb.rb +58 -0
- data/spec/support/test/multi_field_extensions.proto +33 -0
- data/spec/support/test/resource.pb.rb +106 -0
- data/spec/support/test/resource.proto +94 -0
- metadata +306 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Protobuf
|
4
|
+
module Optionable
|
5
|
+
extend ::ActiveSupport::Concern
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def get_option(name)
|
9
|
+
@_optionable_options.try(:[], name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def set_option(name, value = true)
|
13
|
+
@_optionable_options ||= {}
|
14
|
+
@_optionable_options[name] = value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_option(name)
|
19
|
+
self.class.get_option(name)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -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,620 @@
|
|
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
|
+
// 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
|
+
|
41
|
+
package google.protobuf;
|
42
|
+
option java_package = "com.google.protobuf";
|
43
|
+
option java_outer_classname = "DescriptorProtos";
|
44
|
+
|
45
|
+
// descriptor.proto must be optimized for speed because reflection-based
|
46
|
+
// algorithms don't work during bootstrapping.
|
47
|
+
option optimize_for = SPEED;
|
48
|
+
|
49
|
+
// The protocol compiler can output a FileDescriptorSet containing the .proto
|
50
|
+
// files it parses.
|
51
|
+
message FileDescriptorSet {
|
52
|
+
repeated FileDescriptorProto file = 1;
|
53
|
+
}
|
54
|
+
|
55
|
+
// Describes a complete .proto file.
|
56
|
+
message FileDescriptorProto {
|
57
|
+
optional string name = 1; // file name, relative to root of source tree
|
58
|
+
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
59
|
+
|
60
|
+
// Names of files imported by this file.
|
61
|
+
repeated string dependency = 3;
|
62
|
+
// Indexes of the public imported files in the dependency list above.
|
63
|
+
repeated int32 public_dependency = 10;
|
64
|
+
// Indexes of the weak imported files in the dependency list.
|
65
|
+
// For Google-internal migration only. Do not use.
|
66
|
+
repeated int32 weak_dependency = 11;
|
67
|
+
|
68
|
+
// All top-level definitions in this file.
|
69
|
+
repeated DescriptorProto message_type = 4;
|
70
|
+
repeated EnumDescriptorProto enum_type = 5;
|
71
|
+
repeated ServiceDescriptorProto service = 6;
|
72
|
+
repeated FieldDescriptorProto extension = 7;
|
73
|
+
|
74
|
+
optional FileOptions options = 8;
|
75
|
+
|
76
|
+
// This field contains optional information about the original source code.
|
77
|
+
// You may safely remove this entire field whithout harming runtime
|
78
|
+
// functionality of the descriptors -- the information is needed only by
|
79
|
+
// development tools.
|
80
|
+
optional SourceCodeInfo source_code_info = 9;
|
81
|
+
}
|
82
|
+
|
83
|
+
// Describes a message type.
|
84
|
+
message DescriptorProto {
|
85
|
+
optional string name = 1;
|
86
|
+
|
87
|
+
repeated FieldDescriptorProto field = 2;
|
88
|
+
repeated FieldDescriptorProto extension = 6;
|
89
|
+
|
90
|
+
repeated DescriptorProto nested_type = 3;
|
91
|
+
repeated EnumDescriptorProto enum_type = 4;
|
92
|
+
|
93
|
+
message ExtensionRange {
|
94
|
+
optional int32 start = 1;
|
95
|
+
optional int32 end = 2;
|
96
|
+
}
|
97
|
+
repeated ExtensionRange extension_range = 5;
|
98
|
+
|
99
|
+
optional MessageOptions options = 7;
|
100
|
+
}
|
101
|
+
|
102
|
+
// Describes a field within a message.
|
103
|
+
message FieldDescriptorProto {
|
104
|
+
enum Type {
|
105
|
+
// 0 is reserved for errors.
|
106
|
+
// Order is weird for historical reasons.
|
107
|
+
TYPE_DOUBLE = 1;
|
108
|
+
TYPE_FLOAT = 2;
|
109
|
+
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
110
|
+
// negative values are likely.
|
111
|
+
TYPE_INT64 = 3;
|
112
|
+
TYPE_UINT64 = 4;
|
113
|
+
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
114
|
+
// negative values are likely.
|
115
|
+
TYPE_INT32 = 5;
|
116
|
+
TYPE_FIXED64 = 6;
|
117
|
+
TYPE_FIXED32 = 7;
|
118
|
+
TYPE_BOOL = 8;
|
119
|
+
TYPE_STRING = 9;
|
120
|
+
TYPE_GROUP = 10; // Tag-delimited aggregate.
|
121
|
+
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
122
|
+
|
123
|
+
// New in version 2.
|
124
|
+
TYPE_BYTES = 12;
|
125
|
+
TYPE_UINT32 = 13;
|
126
|
+
TYPE_ENUM = 14;
|
127
|
+
TYPE_SFIXED32 = 15;
|
128
|
+
TYPE_SFIXED64 = 16;
|
129
|
+
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
130
|
+
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
131
|
+
};
|
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
|
+
|
141
|
+
optional string name = 1;
|
142
|
+
optional int32 number = 3;
|
143
|
+
optional Label label = 4;
|
144
|
+
|
145
|
+
// If type_name is set, this need not be set. If both this and type_name
|
146
|
+
// are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
|
147
|
+
optional Type type = 5;
|
148
|
+
|
149
|
+
// For message and enum types, this is the name of the type. If the name
|
150
|
+
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
|
151
|
+
// rules are used to find the type (i.e. first the nested types within this
|
152
|
+
// message are searched, then within the parent, on up to the root
|
153
|
+
// namespace).
|
154
|
+
optional string type_name = 6;
|
155
|
+
|
156
|
+
// For extensions, this is the name of the type being extended. It is
|
157
|
+
// resolved in the same manner as type_name.
|
158
|
+
optional string extendee = 2;
|
159
|
+
|
160
|
+
// For numeric types, contains the original text representation of the value.
|
161
|
+
// For booleans, "true" or "false".
|
162
|
+
// For strings, contains the default text contents (not escaped in any way).
|
163
|
+
// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
|
164
|
+
// TODO(kenton): Base-64 encode?
|
165
|
+
optional string default_value = 7;
|
166
|
+
|
167
|
+
optional FieldOptions options = 8;
|
168
|
+
}
|
169
|
+
|
170
|
+
// Describes an enum type.
|
171
|
+
message EnumDescriptorProto {
|
172
|
+
optional string name = 1;
|
173
|
+
|
174
|
+
repeated EnumValueDescriptorProto value = 2;
|
175
|
+
|
176
|
+
optional EnumOptions options = 3;
|
177
|
+
}
|
178
|
+
|
179
|
+
// Describes a value within an enum.
|
180
|
+
message EnumValueDescriptorProto {
|
181
|
+
optional string name = 1;
|
182
|
+
optional int32 number = 2;
|
183
|
+
|
184
|
+
optional EnumValueOptions options = 3;
|
185
|
+
}
|
186
|
+
|
187
|
+
// Describes a service.
|
188
|
+
message ServiceDescriptorProto {
|
189
|
+
optional string name = 1;
|
190
|
+
repeated MethodDescriptorProto method = 2;
|
191
|
+
|
192
|
+
optional ServiceOptions options = 3;
|
193
|
+
}
|
194
|
+
|
195
|
+
// Describes a method of a service.
|
196
|
+
message MethodDescriptorProto {
|
197
|
+
optional string name = 1;
|
198
|
+
|
199
|
+
// Input and output type names. These are resolved in the same way as
|
200
|
+
// FieldDescriptorProto.type_name, but must refer to a message type.
|
201
|
+
optional string input_type = 2;
|
202
|
+
optional string output_type = 3;
|
203
|
+
|
204
|
+
optional MethodOptions options = 4;
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
// ===================================================================
|
209
|
+
// Options
|
210
|
+
|
211
|
+
// Each of the definitions above may have "options" attached. These are
|
212
|
+
// just annotations which may cause code to be generated slightly differently
|
213
|
+
// or may contain hints for code that manipulates protocol messages.
|
214
|
+
//
|
215
|
+
// Clients may define custom options as extensions of the *Options messages.
|
216
|
+
// These extensions may not yet be known at parsing time, so the parser cannot
|
217
|
+
// store the values in them. Instead it stores them in a field in the *Options
|
218
|
+
// message called uninterpreted_option. This field must have the same name
|
219
|
+
// across all *Options messages. We then use this field to populate the
|
220
|
+
// extensions when we build a descriptor, at which point all protos have been
|
221
|
+
// parsed and so all extensions are known.
|
222
|
+
//
|
223
|
+
// Extension numbers for custom options may be chosen as follows:
|
224
|
+
// * For options which will only be used within a single application or
|
225
|
+
// organization, or for experimental options, use field numbers 50000
|
226
|
+
// through 99999. It is up to you to ensure that you do not use the
|
227
|
+
// same number for multiple options.
|
228
|
+
// * For options which will be published and used publicly by multiple
|
229
|
+
// independent entities, e-mail protobuf-global-extension-registry@google.com
|
230
|
+
// to reserve extension numbers. Simply provide your project name (e.g.
|
231
|
+
// Object-C plugin) and your porject website (if available) -- there's no need
|
232
|
+
// to explain how you intend to use them. Usually you only need one extension
|
233
|
+
// number. You can declare multiple options with only one extension number by
|
234
|
+
// putting them in a sub-message. See the Custom Options section of the docs
|
235
|
+
// for examples:
|
236
|
+
// http://code.google.com/apis/protocolbuffers/docs/proto.html#options
|
237
|
+
// If this turns out to be popular, a web service will be set up
|
238
|
+
// to automatically assign option numbers.
|
239
|
+
|
240
|
+
|
241
|
+
message FileOptions {
|
242
|
+
|
243
|
+
// Sets the Java package where classes generated from this .proto will be
|
244
|
+
// placed. By default, the proto package is used, but this is often
|
245
|
+
// inappropriate because proto packages do not normally start with backwards
|
246
|
+
// domain names.
|
247
|
+
optional string java_package = 1;
|
248
|
+
|
249
|
+
|
250
|
+
// If set, all the classes from the .proto file are wrapped in a single
|
251
|
+
// outer class with the given name. This applies to both Proto1
|
252
|
+
// (equivalent to the old "--one_java_file" option) and Proto2 (where
|
253
|
+
// a .proto always translates to a single class, but you may want to
|
254
|
+
// explicitly choose the class name).
|
255
|
+
optional string java_outer_classname = 8;
|
256
|
+
|
257
|
+
// If set true, then the Java code generator will generate a separate .java
|
258
|
+
// file for each top-level message, enum, and service defined in the .proto
|
259
|
+
// file. Thus, these types will *not* be nested inside the outer class
|
260
|
+
// named by java_outer_classname. However, the outer class will still be
|
261
|
+
// generated to contain the file's getDescriptor() method as well as any
|
262
|
+
// top-level extensions defined in the file.
|
263
|
+
optional bool java_multiple_files = 10 [default=false];
|
264
|
+
|
265
|
+
// If set true, then the Java code generator will generate equals() and
|
266
|
+
// hashCode() methods for all messages defined in the .proto file. This is
|
267
|
+
// purely a speed optimization, as the AbstractMessage base class includes
|
268
|
+
// reflection-based implementations of these methods.
|
269
|
+
optional bool java_generate_equals_and_hash = 20 [default=false];
|
270
|
+
|
271
|
+
// Generated classes can be optimized for speed or code size.
|
272
|
+
enum OptimizeMode {
|
273
|
+
SPEED = 1; // Generate complete code for parsing, serialization,
|
274
|
+
// etc.
|
275
|
+
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
276
|
+
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
277
|
+
}
|
278
|
+
optional OptimizeMode optimize_for = 9 [default=SPEED];
|
279
|
+
|
280
|
+
// Sets the Go package where structs generated from this .proto will be
|
281
|
+
// placed. There is no default.
|
282
|
+
optional string go_package = 11;
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
// Should generic services be generated in each language? "Generic" services
|
287
|
+
// are not specific to any particular RPC system. They are generated by the
|
288
|
+
// main code generators in each language (without additional plugins).
|
289
|
+
// Generic services were the only kind of service generation supported by
|
290
|
+
// early versions of proto2.
|
291
|
+
//
|
292
|
+
// Generic services are now considered deprecated in favor of using plugins
|
293
|
+
// that generate code specific to your particular RPC system. Therefore,
|
294
|
+
// these default to false. Old code which depends on generic services should
|
295
|
+
// explicitly set them to true.
|
296
|
+
optional bool cc_generic_services = 16 [default=false];
|
297
|
+
optional bool java_generic_services = 17 [default=false];
|
298
|
+
optional bool py_generic_services = 18 [default=false];
|
299
|
+
|
300
|
+
// The parser stores options it doesn't recognize here. See above.
|
301
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
302
|
+
|
303
|
+
// Clients can define custom options in extensions of this message. See above.
|
304
|
+
extensions 1000 to max;
|
305
|
+
}
|
306
|
+
|
307
|
+
message MessageOptions {
|
308
|
+
// Set true to use the old proto1 MessageSet wire format for extensions.
|
309
|
+
// This is provided for backwards-compatibility with the MessageSet wire
|
310
|
+
// format. You should not use this for any other reason: It's less
|
311
|
+
// efficient, has fewer features, and is more complicated.
|
312
|
+
//
|
313
|
+
// The message must be defined exactly as follows:
|
314
|
+
// message Foo {
|
315
|
+
// option message_set_wire_format = true;
|
316
|
+
// extensions 4 to max;
|
317
|
+
// }
|
318
|
+
// Note that the message cannot have any defined fields; MessageSets only
|
319
|
+
// have extensions.
|
320
|
+
//
|
321
|
+
// All extensions of your type must be singular messages; e.g. they cannot
|
322
|
+
// be int32s, enums, or repeated messages.
|
323
|
+
//
|
324
|
+
// Because this is an option, the above two restrictions are not enforced by
|
325
|
+
// the protocol compiler.
|
326
|
+
optional bool message_set_wire_format = 1 [default=false];
|
327
|
+
|
328
|
+
// Disables the generation of the standard "descriptor()" accessor, which can
|
329
|
+
// conflict with a field of the same name. This is meant to make migration
|
330
|
+
// from proto1 easier; new code should avoid fields named "descriptor".
|
331
|
+
optional bool no_standard_descriptor_accessor = 2 [default=false];
|
332
|
+
|
333
|
+
// The parser stores options it doesn't recognize here. See above.
|
334
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
335
|
+
|
336
|
+
// Clients can define custom options in extensions of this message. See above.
|
337
|
+
extensions 1000 to max;
|
338
|
+
}
|
339
|
+
|
340
|
+
message FieldOptions {
|
341
|
+
// The ctype option instructs the C++ code generator to use a different
|
342
|
+
// representation of the field than it normally would. See the specific
|
343
|
+
// options below. This option is not yet implemented in the open source
|
344
|
+
// release -- sorry, we'll try to include it in a future version!
|
345
|
+
optional CType ctype = 1 [default = STRING];
|
346
|
+
enum CType {
|
347
|
+
// Default mode.
|
348
|
+
STRING = 0;
|
349
|
+
|
350
|
+
CORD = 1;
|
351
|
+
|
352
|
+
STRING_PIECE = 2;
|
353
|
+
}
|
354
|
+
// The packed option can be enabled for repeated primitive fields to enable
|
355
|
+
// a more efficient representation on the wire. Rather than repeatedly
|
356
|
+
// writing the tag and type for each element, the entire array is encoded as
|
357
|
+
// a single length-delimited blob.
|
358
|
+
optional bool packed = 2;
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
// Should this field be parsed lazily? Lazy applies only to message-type
|
363
|
+
// fields. It means that when the outer message is initially parsed, the
|
364
|
+
// inner message's contents will not be parsed but instead stored in encoded
|
365
|
+
// form. The inner message will actually be parsed when it is first accessed.
|
366
|
+
//
|
367
|
+
// This is only a hint. Implementations are free to choose whether to use
|
368
|
+
// eager or lazy parsing regardless of the value of this option. However,
|
369
|
+
// setting this option true suggests that the protocol author believes that
|
370
|
+
// using lazy parsing on this field is worth the additional bookkeeping
|
371
|
+
// overhead typically needed to implement it.
|
372
|
+
//
|
373
|
+
// This option does not affect the public interface of any generated code;
|
374
|
+
// all method signatures remain the same. Furthermore, thread-safety of the
|
375
|
+
// interface is not affected by this option; const methods remain safe to
|
376
|
+
// call from multiple threads concurrently, while non-const methods continue
|
377
|
+
// to require exclusive access.
|
378
|
+
//
|
379
|
+
//
|
380
|
+
// Note that implementations may choose not to check required fields within
|
381
|
+
// a lazy sub-message. That is, calling IsInitialized() on the outher message
|
382
|
+
// may return true even if the inner message has missing required fields.
|
383
|
+
// This is necessary because otherwise the inner message would have to be
|
384
|
+
// parsed in order to perform the check, defeating the purpose of lazy
|
385
|
+
// parsing. An implementation which chooses not to check required fields
|
386
|
+
// must be consistent about it. That is, for any particular sub-message, the
|
387
|
+
// implementation must either *always* check its required fields, or *never*
|
388
|
+
// check its required fields, regardless of whether or not the message has
|
389
|
+
// been parsed.
|
390
|
+
optional bool lazy = 5 [default=false];
|
391
|
+
|
392
|
+
// Is this field deprecated?
|
393
|
+
// Depending on the target platform, this can emit Deprecated annotations
|
394
|
+
// for accessors, or it will be completely ignored; in the very least, this
|
395
|
+
// is a formalization for deprecating fields.
|
396
|
+
optional bool deprecated = 3 [default=false];
|
397
|
+
|
398
|
+
// EXPERIMENTAL. DO NOT USE.
|
399
|
+
// For "map" fields, the name of the field in the enclosed type that
|
400
|
+
// is the key for this map. For example, suppose we have:
|
401
|
+
// message Item {
|
402
|
+
// required string name = 1;
|
403
|
+
// required string value = 2;
|
404
|
+
// }
|
405
|
+
// message Config {
|
406
|
+
// repeated Item items = 1 [experimental_map_key="name"];
|
407
|
+
// }
|
408
|
+
// In this situation, the map key for Item will be set to "name".
|
409
|
+
// TODO: Fully-implement this, then remove the "experimental_" prefix.
|
410
|
+
optional string experimental_map_key = 9;
|
411
|
+
|
412
|
+
// For Google-internal migration only. Do not use.
|
413
|
+
optional bool weak = 10 [default=false];
|
414
|
+
|
415
|
+
// The parser stores options it doesn't recognize here. See above.
|
416
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
417
|
+
|
418
|
+
// Clients can define custom options in extensions of this message. See above.
|
419
|
+
extensions 1000 to max;
|
420
|
+
}
|
421
|
+
|
422
|
+
message EnumOptions {
|
423
|
+
|
424
|
+
// Set this option to false to disallow mapping different tag names to a same
|
425
|
+
// value.
|
426
|
+
optional bool allow_alias = 2 [default=true];
|
427
|
+
|
428
|
+
// The parser stores options it doesn't recognize here. See above.
|
429
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
430
|
+
|
431
|
+
// Clients can define custom options in extensions of this message. See above.
|
432
|
+
extensions 1000 to max;
|
433
|
+
}
|
434
|
+
|
435
|
+
message EnumValueOptions {
|
436
|
+
// The parser stores options it doesn't recognize here. See above.
|
437
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
438
|
+
|
439
|
+
// Clients can define custom options in extensions of this message. See above.
|
440
|
+
extensions 1000 to max;
|
441
|
+
}
|
442
|
+
|
443
|
+
message ServiceOptions {
|
444
|
+
|
445
|
+
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
446
|
+
// framework. We apologize for hoarding these numbers to ourselves, but
|
447
|
+
// we were already using them long before we decided to release Protocol
|
448
|
+
// Buffers.
|
449
|
+
|
450
|
+
// The parser stores options it doesn't recognize here. See above.
|
451
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
452
|
+
|
453
|
+
// Clients can define custom options in extensions of this message. See above.
|
454
|
+
extensions 1000 to max;
|
455
|
+
}
|
456
|
+
|
457
|
+
message MethodOptions {
|
458
|
+
|
459
|
+
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
460
|
+
// framework. We apologize for hoarding these numbers to ourselves, but
|
461
|
+
// we were already using them long before we decided to release Protocol
|
462
|
+
// Buffers.
|
463
|
+
|
464
|
+
// The parser stores options it doesn't recognize here. See above.
|
465
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
466
|
+
|
467
|
+
// Clients can define custom options in extensions of this message. See above.
|
468
|
+
extensions 1000 to max;
|
469
|
+
}
|
470
|
+
|
471
|
+
|
472
|
+
// A message representing a option the parser does not recognize. This only
|
473
|
+
// appears in options protos created by the compiler::Parser class.
|
474
|
+
// DescriptorPool resolves these when building Descriptor objects. Therefore,
|
475
|
+
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
|
476
|
+
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
|
477
|
+
// in them.
|
478
|
+
message UninterpretedOption {
|
479
|
+
// The name of the uninterpreted option. Each string represents a segment in
|
480
|
+
// a dot-separated name. is_extension is true iff a segment represents an
|
481
|
+
// extension (denoted with parentheses in options specs in .proto files).
|
482
|
+
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
|
483
|
+
// "foo.(bar.baz).qux".
|
484
|
+
message NamePart {
|
485
|
+
required string name_part = 1;
|
486
|
+
required bool is_extension = 2;
|
487
|
+
}
|
488
|
+
repeated NamePart name = 2;
|
489
|
+
|
490
|
+
// The value of the uninterpreted option, in whatever type the tokenizer
|
491
|
+
// identified it as during parsing. Exactly one of these should be set.
|
492
|
+
optional string identifier_value = 3;
|
493
|
+
optional uint64 positive_int_value = 4;
|
494
|
+
optional int64 negative_int_value = 5;
|
495
|
+
optional double double_value = 6;
|
496
|
+
optional bytes string_value = 7;
|
497
|
+
optional string aggregate_value = 8;
|
498
|
+
}
|
499
|
+
|
500
|
+
// ===================================================================
|
501
|
+
// Optional source code info
|
502
|
+
|
503
|
+
// Encapsulates information about the original source file from which a
|
504
|
+
// FileDescriptorProto was generated.
|
505
|
+
message SourceCodeInfo {
|
506
|
+
// A Location identifies a piece of source code in a .proto file which
|
507
|
+
// corresponds to a particular definition. This information is intended
|
508
|
+
// to be useful to IDEs, code indexers, documentation generators, and similar
|
509
|
+
// tools.
|
510
|
+
//
|
511
|
+
// For example, say we have a file like:
|
512
|
+
// message Foo {
|
513
|
+
// optional string foo = 1;
|
514
|
+
// }
|
515
|
+
// Let's look at just the field definition:
|
516
|
+
// optional string foo = 1;
|
517
|
+
// ^ ^^ ^^ ^ ^^^
|
518
|
+
// a bc de f ghi
|
519
|
+
// We have the following locations:
|
520
|
+
// span path represents
|
521
|
+
// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
|
522
|
+
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
|
523
|
+
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
|
524
|
+
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
|
525
|
+
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
|
526
|
+
//
|
527
|
+
// Notes:
|
528
|
+
// - A location may refer to a repeated field itself (i.e. not to any
|
529
|
+
// particular index within it). This is used whenever a set of elements are
|
530
|
+
// logically enclosed in a single code segment. For example, an entire
|
531
|
+
// extend block (possibly containing multiple extension definitions) will
|
532
|
+
// have an outer location whose path refers to the "extensions" repeated
|
533
|
+
// field without an index.
|
534
|
+
// - Multiple locations may have the same path. This happens when a single
|
535
|
+
// logical declaration is spread out across multiple places. The most
|
536
|
+
// obvious example is the "extend" block again -- there may be multiple
|
537
|
+
// extend blocks in the same scope, each of which will have the same path.
|
538
|
+
// - A location's span is not always a subset of its parent's span. For
|
539
|
+
// example, the "extendee" of an extension declaration appears at the
|
540
|
+
// beginning of the "extend" block and is shared by all extensions within
|
541
|
+
// the block.
|
542
|
+
// - Just because a location's span is a subset of some other location's span
|
543
|
+
// does not mean that it is a descendent. For example, a "group" defines
|
544
|
+
// both a type and a field in a single declaration. Thus, the locations
|
545
|
+
// corresponding to the type and field and their components will overlap.
|
546
|
+
// - Code which tries to interpret locations should probably be designed to
|
547
|
+
// ignore those that it doesn't understand, as more types of locations could
|
548
|
+
// be recorded in the future.
|
549
|
+
repeated Location location = 1;
|
550
|
+
message Location {
|
551
|
+
// Identifies which part of the FileDescriptorProto was defined at this
|
552
|
+
// location.
|
553
|
+
//
|
554
|
+
// Each element is a field number or an index. They form a path from
|
555
|
+
// the root FileDescriptorProto to the place where the definition. For
|
556
|
+
// example, this path:
|
557
|
+
// [ 4, 3, 2, 7, 1 ]
|
558
|
+
// refers to:
|
559
|
+
// file.message_type(3) // 4, 3
|
560
|
+
// .field(7) // 2, 7
|
561
|
+
// .name() // 1
|
562
|
+
// This is because FileDescriptorProto.message_type has field number 4:
|
563
|
+
// repeated DescriptorProto message_type = 4;
|
564
|
+
// and DescriptorProto.field has field number 2:
|
565
|
+
// repeated FieldDescriptorProto field = 2;
|
566
|
+
// and FieldDescriptorProto.name has field number 1:
|
567
|
+
// optional string name = 1;
|
568
|
+
//
|
569
|
+
// Thus, the above path gives the location of a field name. If we removed
|
570
|
+
// the last element:
|
571
|
+
// [ 4, 3, 2, 7 ]
|
572
|
+
// this path refers to the whole field declaration (from the beginning
|
573
|
+
// of the label to the terminating semicolon).
|
574
|
+
repeated int32 path = 1 [packed=true];
|
575
|
+
|
576
|
+
// Always has exactly three or four elements: start line, start column,
|
577
|
+
// end line (optional, otherwise assumed same as start line), end column.
|
578
|
+
// These are packed into a single field for efficiency. Note that line
|
579
|
+
// and column numbers are zero-based -- typically you will want to add
|
580
|
+
// 1 to each before displaying to a user.
|
581
|
+
repeated int32 span = 2 [packed=true];
|
582
|
+
|
583
|
+
// If this SourceCodeInfo represents a complete declaration, these are any
|
584
|
+
// comments appearing before and after the declaration which appear to be
|
585
|
+
// attached to the declaration.
|
586
|
+
//
|
587
|
+
// A series of line comments appearing on consecutive lines, with no other
|
588
|
+
// tokens appearing on those lines, will be treated as a single comment.
|
589
|
+
//
|
590
|
+
// Only the comment content is provided; comment markers (e.g. //) are
|
591
|
+
// stripped out. For block comments, leading whitespace and an asterisk
|
592
|
+
// will be stripped from the beginning of each line other than the first.
|
593
|
+
// Newlines are included in the output.
|
594
|
+
//
|
595
|
+
// Examples:
|
596
|
+
//
|
597
|
+
// optional int32 foo = 1; // Comment attached to foo.
|
598
|
+
// // Comment attached to bar.
|
599
|
+
// optional int32 bar = 2;
|
600
|
+
//
|
601
|
+
// optional string baz = 3;
|
602
|
+
// // Comment attached to baz.
|
603
|
+
// // Another line attached to baz.
|
604
|
+
//
|
605
|
+
// // Comment attached to qux.
|
606
|
+
// //
|
607
|
+
// // Another line attached to qux.
|
608
|
+
// optional double qux = 4;
|
609
|
+
//
|
610
|
+
// optional string corge = 5;
|
611
|
+
// /* Block comment attached
|
612
|
+
// * to corge. Leading asterisks
|
613
|
+
// * will be removed. */
|
614
|
+
// /* Block comment attached to
|
615
|
+
// * grault. */
|
616
|
+
// optional int32 grault = 6;
|
617
|
+
optional string leading_comments = 3;
|
618
|
+
optional string trailing_comments = 4;
|
619
|
+
}
|
620
|
+
}
|