protobuf 3.10.4 → 3.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -2
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +11 -0
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +65 -6
- data/lib/protobuf/generators/enum_generator.rb +1 -0
- data/lib/protobuf/generators/field_generator.rb +2 -0
- data/lib/protobuf/rpc/error.rb +4 -4
- data/lib/protobuf/rpc/middleware/exception_handler.rb +12 -1
- data/lib/protobuf/version.rb +1 -1
- data/proto/google/protobuf/compiler/plugin.proto +25 -1
- data/proto/google/protobuf/descriptor.proto +228 -96
- data/spec/lib/protobuf/generators/enum_generator_spec.rb +11 -0
- data/spec/lib/protobuf/generators/field_generator_spec.rb +11 -0
- data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +3 -3
- data/spec/lib/protobuf/rpc/stat_spec.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f345ac51b45d74ca337c48e64d8ffb42e2447827e9fa5b483a7602ef47cc6743
|
4
|
+
data.tar.gz: d5ac75f75f3e27c75d4ad2066bd5160df7288136fd5c87323a7918034c025adb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c4eb8312892d27bbb8f0f2917a63fd40519c3d6b3e36eb8825128d086d2913fe73f0d3db6acf035086a4b628ffe7ed3d838718f3301061edbf21f5bca81edb
|
7
|
+
data.tar.gz: 6fa9ec62ef8a47feec93a6b9f6b2c1cad220b1dd2001dd4b96a5ac75c1a3f7b81a2c7ee4342244e61ba649a7d075e572991bb162ff1b85cb6f2d5cf974e63d7c
|
data/.circleci/config.yml
CHANGED
@@ -19,6 +19,7 @@ module Google
|
|
19
19
|
##
|
20
20
|
# Message Classes
|
21
21
|
#
|
22
|
+
class Version < ::Protobuf::Message; end
|
22
23
|
class CodeGeneratorRequest < ::Protobuf::Message; end
|
23
24
|
class CodeGeneratorResponse < ::Protobuf::Message
|
24
25
|
class Feature < ::Protobuf::Enum
|
@@ -37,15 +38,24 @@ module Google
|
|
37
38
|
#
|
38
39
|
set_option :java_package, "com.google.protobuf.compiler"
|
39
40
|
set_option :java_outer_classname, "PluginProtos"
|
41
|
+
set_option :go_package, "google.golang.org/protobuf/types/pluginpb"
|
40
42
|
|
41
43
|
|
42
44
|
##
|
43
45
|
# Message Fields
|
44
46
|
#
|
47
|
+
class Version
|
48
|
+
optional :int32, :major, 1
|
49
|
+
optional :int32, :minor, 2
|
50
|
+
optional :int32, :patch, 3
|
51
|
+
optional :string, :suffix, 4
|
52
|
+
end
|
53
|
+
|
45
54
|
class CodeGeneratorRequest
|
46
55
|
repeated :string, :file_to_generate, 1
|
47
56
|
optional :string, :parameter, 2
|
48
57
|
repeated ::Google::Protobuf::FileDescriptorProto, :proto_file, 15
|
58
|
+
optional ::Google::Protobuf::Compiler::Version, :compiler_version, 3
|
49
59
|
end
|
50
60
|
|
51
61
|
class CodeGeneratorResponse
|
@@ -53,6 +63,7 @@ module Google
|
|
53
63
|
optional :string, :name, 1
|
54
64
|
optional :string, :insertion_point, 2
|
55
65
|
optional :string, :content, 15
|
66
|
+
optional ::Google::Protobuf::GeneratedCodeInfo, :generated_code_info, 16
|
56
67
|
end
|
57
68
|
|
58
69
|
optional :string, :error, 1
|
@@ -20,6 +20,7 @@ module Google
|
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
|
+
class ExtensionRangeOptions < ::Protobuf::Message; end
|
23
24
|
class FieldDescriptorProto < ::Protobuf::Message
|
24
25
|
class Type < ::Protobuf::Enum
|
25
26
|
define :TYPE_DOUBLE, 1
|
@@ -51,7 +52,11 @@ module Google
|
|
51
52
|
end
|
52
53
|
|
53
54
|
class OneofDescriptorProto < ::Protobuf::Message; end
|
54
|
-
class EnumDescriptorProto < ::Protobuf::Message
|
55
|
+
class EnumDescriptorProto < ::Protobuf::Message
|
56
|
+
class EnumReservedRange < ::Protobuf::Message; end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
55
60
|
class EnumValueDescriptorProto < ::Protobuf::Message; end
|
56
61
|
class ServiceDescriptorProto < ::Protobuf::Message; end
|
57
62
|
class MethodDescriptorProto < ::Protobuf::Message; end
|
@@ -80,10 +85,19 @@ module Google
|
|
80
85
|
|
81
86
|
end
|
82
87
|
|
88
|
+
class OneofOptions < ::Protobuf::Message; end
|
83
89
|
class EnumOptions < ::Protobuf::Message; end
|
84
90
|
class EnumValueOptions < ::Protobuf::Message; end
|
85
91
|
class ServiceOptions < ::Protobuf::Message; end
|
86
|
-
class MethodOptions < ::Protobuf::Message
|
92
|
+
class MethodOptions < ::Protobuf::Message
|
93
|
+
class IdempotencyLevel < ::Protobuf::Enum
|
94
|
+
define :IDEMPOTENCY_UNKNOWN, 0
|
95
|
+
define :NO_SIDE_EFFECTS, 1
|
96
|
+
define :IDEMPOTENT, 2
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
87
101
|
class UninterpretedOption < ::Protobuf::Message
|
88
102
|
class NamePart < ::Protobuf::Message; end
|
89
103
|
|
@@ -94,6 +108,11 @@ module Google
|
|
94
108
|
|
95
109
|
end
|
96
110
|
|
111
|
+
class GeneratedCodeInfo < ::Protobuf::Message
|
112
|
+
class Annotation < ::Protobuf::Message; end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
97
116
|
|
98
117
|
|
99
118
|
##
|
@@ -102,7 +121,8 @@ module Google
|
|
102
121
|
set_option :java_package, "com.google.protobuf"
|
103
122
|
set_option :java_outer_classname, "DescriptorProtos"
|
104
123
|
set_option :optimize_for, ::Google::Protobuf::FileOptions::OptimizeMode::SPEED
|
105
|
-
set_option :go_package, "
|
124
|
+
set_option :go_package, "google.golang.org/protobuf/types/descriptorpb"
|
125
|
+
set_option :cc_enable_arenas, true
|
106
126
|
set_option :objc_class_prefix, "GPB"
|
107
127
|
set_option :csharp_namespace, "Google.Protobuf.Reflection"
|
108
128
|
|
@@ -133,6 +153,7 @@ module Google
|
|
133
153
|
class ExtensionRange
|
134
154
|
optional :int32, :start, 1
|
135
155
|
optional :int32, :end, 2
|
156
|
+
optional ::Google::Protobuf::ExtensionRangeOptions, :options, 3
|
136
157
|
end
|
137
158
|
|
138
159
|
class ReservedRange
|
@@ -152,6 +173,12 @@ module Google
|
|
152
173
|
repeated :string, :reserved_name, 10
|
153
174
|
end
|
154
175
|
|
176
|
+
class ExtensionRangeOptions
|
177
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
178
|
+
# Extension Fields
|
179
|
+
extensions 1000...536870912
|
180
|
+
end
|
181
|
+
|
155
182
|
class FieldDescriptorProto
|
156
183
|
optional :string, :name, 1
|
157
184
|
optional :int32, :number, 3
|
@@ -163,16 +190,25 @@ module Google
|
|
163
190
|
optional :int32, :oneof_index, 9
|
164
191
|
optional :string, :json_name, 10
|
165
192
|
optional ::Google::Protobuf::FieldOptions, :options, 8
|
193
|
+
optional :bool, :proto3_optional, 17
|
166
194
|
end
|
167
195
|
|
168
196
|
class OneofDescriptorProto
|
169
197
|
optional :string, :name, 1
|
198
|
+
optional ::Google::Protobuf::OneofOptions, :options, 2
|
170
199
|
end
|
171
200
|
|
172
201
|
class EnumDescriptorProto
|
202
|
+
class EnumReservedRange
|
203
|
+
optional :int32, :start, 1
|
204
|
+
optional :int32, :end, 2
|
205
|
+
end
|
206
|
+
|
173
207
|
optional :string, :name, 1
|
174
208
|
repeated ::Google::Protobuf::EnumValueDescriptorProto, :value, 2
|
175
209
|
optional ::Google::Protobuf::EnumOptions, :options, 3
|
210
|
+
repeated ::Google::Protobuf::EnumDescriptorProto::EnumReservedRange, :reserved_range, 4
|
211
|
+
repeated :string, :reserved_name, 5
|
176
212
|
end
|
177
213
|
|
178
214
|
class EnumValueDescriptorProto
|
@@ -200,18 +236,23 @@ module Google
|
|
200
236
|
optional :string, :java_package, 1
|
201
237
|
optional :string, :java_outer_classname, 8
|
202
238
|
optional :bool, :java_multiple_files, 10, :default => false
|
203
|
-
optional :bool, :java_generate_equals_and_hash, 20, :
|
239
|
+
optional :bool, :java_generate_equals_and_hash, 20, :deprecated => true
|
204
240
|
optional :bool, :java_string_check_utf8, 27, :default => false
|
205
241
|
optional ::Google::Protobuf::FileOptions::OptimizeMode, :optimize_for, 9, :default => ::Google::Protobuf::FileOptions::OptimizeMode::SPEED
|
206
242
|
optional :string, :go_package, 11
|
207
243
|
optional :bool, :cc_generic_services, 16, :default => false
|
208
244
|
optional :bool, :java_generic_services, 17, :default => false
|
209
245
|
optional :bool, :py_generic_services, 18, :default => false
|
246
|
+
optional :bool, :php_generic_services, 42, :default => false
|
210
247
|
optional :bool, :deprecated, 23, :default => false
|
211
|
-
optional :bool, :cc_enable_arenas, 31, :default =>
|
248
|
+
optional :bool, :cc_enable_arenas, 31, :default => true
|
212
249
|
optional :string, :objc_class_prefix, 36
|
213
250
|
optional :string, :csharp_namespace, 37
|
214
|
-
optional :
|
251
|
+
optional :string, :swift_prefix, 39
|
252
|
+
optional :string, :php_class_prefix, 40
|
253
|
+
optional :string, :php_namespace, 41
|
254
|
+
optional :string, :php_metadata_namespace, 44
|
255
|
+
optional :string, :ruby_package, 45
|
215
256
|
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
216
257
|
# Extension Fields
|
217
258
|
extensions 1000...536870912
|
@@ -239,6 +280,12 @@ module Google
|
|
239
280
|
extensions 1000...536870912
|
240
281
|
end
|
241
282
|
|
283
|
+
class OneofOptions
|
284
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
285
|
+
# Extension Fields
|
286
|
+
extensions 1000...536870912
|
287
|
+
end
|
288
|
+
|
242
289
|
class EnumOptions
|
243
290
|
optional :bool, :allow_alias, 2
|
244
291
|
optional :bool, :deprecated, 3, :default => false
|
@@ -263,6 +310,7 @@ module Google
|
|
263
310
|
|
264
311
|
class MethodOptions
|
265
312
|
optional :bool, :deprecated, 33, :default => false
|
313
|
+
optional ::Google::Protobuf::MethodOptions::IdempotencyLevel, :idempotency_level, 34, :default => ::Google::Protobuf::MethodOptions::IdempotencyLevel::IDEMPOTENCY_UNKNOWN
|
266
314
|
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
267
315
|
# Extension Fields
|
268
316
|
extensions 1000...536870912
|
@@ -295,6 +343,17 @@ module Google
|
|
295
343
|
repeated ::Google::Protobuf::SourceCodeInfo::Location, :location, 1
|
296
344
|
end
|
297
345
|
|
346
|
+
class GeneratedCodeInfo
|
347
|
+
class Annotation
|
348
|
+
repeated :int32, :path, 1, :packed => true
|
349
|
+
optional :string, :source_file, 2
|
350
|
+
optional :int32, :begin, 3
|
351
|
+
optional :int32, :end, 4
|
352
|
+
end
|
353
|
+
|
354
|
+
repeated ::Google::Protobuf::GeneratedCodeInfo::Annotation, :annotation, 1
|
355
|
+
end
|
356
|
+
|
298
357
|
end
|
299
358
|
|
300
359
|
end
|
@@ -29,6 +29,7 @@ module Protobuf
|
|
29
29
|
|
30
30
|
def build_value(enum_value_descriptor)
|
31
31
|
name = enum_value_descriptor.name
|
32
|
+
name.capitalize! if ENV.key?('PB_CAPITALIZE_ENUMS')
|
32
33
|
name.upcase! if ENV.key?('PB_UPCASE_ENUMS')
|
33
34
|
number = enum_value_descriptor.number
|
34
35
|
"define :#{name}, #{number}"
|
data/lib/protobuf/rpc/error.rb
CHANGED
@@ -13,12 +13,12 @@ module Protobuf
|
|
13
13
|
super message
|
14
14
|
end
|
15
15
|
|
16
|
-
def encode
|
17
|
-
to_response.encode
|
16
|
+
def encode(args = {})
|
17
|
+
to_response(args).encode
|
18
18
|
end
|
19
19
|
|
20
|
-
def to_response
|
21
|
-
::Protobuf::Socketrpc::Response.new(:error => message, :error_reason => error_type)
|
20
|
+
def to_response(args = {})
|
21
|
+
::Protobuf::Socketrpc::Response.new({ :error => message, :error_reason => error_type }.merge(args))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -22,7 +22,7 @@ module Protobuf
|
|
22
22
|
# Rescue exceptions, re-wrap them as generic Protobuf errors,
|
23
23
|
# and encode them
|
24
24
|
env.response = wrap_exception(exception)
|
25
|
-
env.encoded_response = env.response
|
25
|
+
env.encoded_response = wrap_and_encode_with_server(env.response, env)
|
26
26
|
env
|
27
27
|
end
|
28
28
|
|
@@ -34,6 +34,17 @@ module Protobuf
|
|
34
34
|
exception = RpcFailed.new(exception.message) unless exception.is_a?(PbError)
|
35
35
|
exception
|
36
36
|
end
|
37
|
+
|
38
|
+
# If the response is a PbError, it won't have the server merged into the response proto.
|
39
|
+
# We should add it here since exception handler is always at the bottom of the middleware
|
40
|
+
# stack. Without this, the server hostname in the client rpc log will not be set.
|
41
|
+
def wrap_and_encode_with_server(response, env)
|
42
|
+
if response.is_a?(PbError)
|
43
|
+
response.encode(:server => env.server)
|
44
|
+
else
|
45
|
+
response.encode
|
46
|
+
end
|
47
|
+
end
|
37
48
|
end
|
38
49
|
end
|
39
50
|
end
|
data/lib/protobuf/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// Protocol Buffers - Google's data interchange format
|
2
2
|
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
-
//
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
4
|
//
|
5
5
|
// Redistribution and use in source and binary forms, with or without
|
6
6
|
// modification, are permitted provided that the following conditions are
|
@@ -50,8 +50,20 @@ package google.protobuf.compiler;
|
|
50
50
|
option java_package = "com.google.protobuf.compiler";
|
51
51
|
option java_outer_classname = "PluginProtos";
|
52
52
|
|
53
|
+
option go_package = "google.golang.org/protobuf/types/pluginpb";
|
54
|
+
|
53
55
|
import "google/protobuf/descriptor.proto";
|
54
56
|
|
57
|
+
// The version number of protocol compiler.
|
58
|
+
message Version {
|
59
|
+
optional int32 major = 1;
|
60
|
+
optional int32 minor = 2;
|
61
|
+
optional int32 patch = 3;
|
62
|
+
// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
|
63
|
+
// be empty for mainline stable releases.
|
64
|
+
optional string suffix = 4;
|
65
|
+
}
|
66
|
+
|
55
67
|
// An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
56
68
|
message CodeGeneratorRequest {
|
57
69
|
// The .proto files that were explicitly listed on the command-line. The
|
@@ -73,7 +85,14 @@ message CodeGeneratorRequest {
|
|
73
85
|
// the entire set into memory at once. However, as of this writing, this
|
74
86
|
// is not similarly optimized on protoc's end -- it will store all fields in
|
75
87
|
// memory at once before sending them to the plugin.
|
88
|
+
//
|
89
|
+
// Type names of fields and extensions in the FileDescriptorProto are always
|
90
|
+
// fully qualified.
|
76
91
|
repeated FileDescriptorProto proto_file = 15;
|
92
|
+
|
93
|
+
// The version number of protocol compiler.
|
94
|
+
optional Version compiler_version = 3;
|
95
|
+
|
77
96
|
}
|
78
97
|
|
79
98
|
// The plugin writes an encoded CodeGeneratorResponse to stdout.
|
@@ -154,6 +173,11 @@ message CodeGeneratorResponse {
|
|
154
173
|
|
155
174
|
// The file contents.
|
156
175
|
optional string content = 15;
|
176
|
+
|
177
|
+
// Information describing the file content being inserted. If an insertion
|
178
|
+
// point is used, this information will be appropriately offset and inserted
|
179
|
+
// into the code generation metadata for the generated files.
|
180
|
+
optional GeneratedCodeInfo generated_code_info = 16;
|
157
181
|
}
|
158
182
|
repeated File file = 15;
|
159
183
|
}
|
@@ -40,11 +40,13 @@
|
|
40
40
|
syntax = "proto2";
|
41
41
|
|
42
42
|
package google.protobuf;
|
43
|
-
|
43
|
+
|
44
|
+
option go_package = "google.golang.org/protobuf/types/descriptorpb";
|
44
45
|
option java_package = "com.google.protobuf";
|
45
46
|
option java_outer_classname = "DescriptorProtos";
|
46
47
|
option csharp_namespace = "Google.Protobuf.Reflection";
|
47
48
|
option objc_class_prefix = "GPB";
|
49
|
+
option cc_enable_arenas = true;
|
48
50
|
|
49
51
|
// descriptor.proto must be optimized for speed because reflection-based
|
50
52
|
// algorithms don't work during bootstrapping.
|
@@ -58,8 +60,8 @@ message FileDescriptorSet {
|
|
58
60
|
|
59
61
|
// Describes a complete .proto file.
|
60
62
|
message FileDescriptorProto {
|
61
|
-
optional string name = 1;
|
62
|
-
optional string package = 2;
|
63
|
+
optional string name = 1; // file name, relative to root of source tree
|
64
|
+
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
63
65
|
|
64
66
|
// Names of files imported by this file.
|
65
67
|
repeated string dependency = 3;
|
@@ -99,8 +101,10 @@ message DescriptorProto {
|
|
99
101
|
repeated EnumDescriptorProto enum_type = 4;
|
100
102
|
|
101
103
|
message ExtensionRange {
|
102
|
-
optional int32 start = 1;
|
103
|
-
optional int32 end = 2;
|
104
|
+
optional int32 start = 1; // Inclusive.
|
105
|
+
optional int32 end = 2; // Exclusive.
|
106
|
+
|
107
|
+
optional ExtensionRangeOptions options = 3;
|
104
108
|
}
|
105
109
|
repeated ExtensionRange extension_range = 5;
|
106
110
|
|
@@ -112,8 +116,8 @@ message DescriptorProto {
|
|
112
116
|
// fields or extension ranges in the same message. Reserved ranges may
|
113
117
|
// not overlap.
|
114
118
|
message ReservedRange {
|
115
|
-
optional int32 start = 1;
|
116
|
-
optional int32 end = 2;
|
119
|
+
optional int32 start = 1; // Inclusive.
|
120
|
+
optional int32 end = 2; // Exclusive.
|
117
121
|
}
|
118
122
|
repeated ReservedRange reserved_range = 9;
|
119
123
|
// Reserved field names, which may not be used by fields in the same message.
|
@@ -121,44 +125,56 @@ message DescriptorProto {
|
|
121
125
|
repeated string reserved_name = 10;
|
122
126
|
}
|
123
127
|
|
128
|
+
message ExtensionRangeOptions {
|
129
|
+
// The parser stores options it doesn't recognize here. See above.
|
130
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
131
|
+
|
132
|
+
|
133
|
+
// Clients can define custom options in extensions of this message. See above.
|
134
|
+
extensions 1000 to max;
|
135
|
+
}
|
136
|
+
|
124
137
|
// Describes a field within a message.
|
125
138
|
message FieldDescriptorProto {
|
126
139
|
enum Type {
|
127
140
|
// 0 is reserved for errors.
|
128
141
|
// Order is weird for historical reasons.
|
129
|
-
TYPE_DOUBLE
|
130
|
-
TYPE_FLOAT
|
142
|
+
TYPE_DOUBLE = 1;
|
143
|
+
TYPE_FLOAT = 2;
|
131
144
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
132
145
|
// negative values are likely.
|
133
|
-
TYPE_INT64
|
134
|
-
TYPE_UINT64
|
146
|
+
TYPE_INT64 = 3;
|
147
|
+
TYPE_UINT64 = 4;
|
135
148
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
136
149
|
// negative values are likely.
|
137
|
-
TYPE_INT32
|
138
|
-
TYPE_FIXED64
|
139
|
-
TYPE_FIXED32
|
140
|
-
TYPE_BOOL
|
141
|
-
TYPE_STRING
|
142
|
-
|
143
|
-
|
150
|
+
TYPE_INT32 = 5;
|
151
|
+
TYPE_FIXED64 = 6;
|
152
|
+
TYPE_FIXED32 = 7;
|
153
|
+
TYPE_BOOL = 8;
|
154
|
+
TYPE_STRING = 9;
|
155
|
+
// Tag-delimited aggregate.
|
156
|
+
// Group type is deprecated and not supported in proto3. However, Proto3
|
157
|
+
// implementations should still be able to parse the group wire format and
|
158
|
+
// treat group fields as unknown fields.
|
159
|
+
TYPE_GROUP = 10;
|
160
|
+
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
144
161
|
|
145
162
|
// New in version 2.
|
146
|
-
TYPE_BYTES
|
147
|
-
TYPE_UINT32
|
148
|
-
TYPE_ENUM
|
149
|
-
TYPE_SFIXED32
|
150
|
-
TYPE_SFIXED64
|
151
|
-
TYPE_SINT32
|
152
|
-
TYPE_SINT64
|
153
|
-
}
|
163
|
+
TYPE_BYTES = 12;
|
164
|
+
TYPE_UINT32 = 13;
|
165
|
+
TYPE_ENUM = 14;
|
166
|
+
TYPE_SFIXED32 = 15;
|
167
|
+
TYPE_SFIXED64 = 16;
|
168
|
+
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
169
|
+
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
170
|
+
}
|
154
171
|
|
155
172
|
enum Label {
|
156
173
|
// 0 is reserved for errors
|
157
|
-
LABEL_OPTIONAL
|
158
|
-
LABEL_REQUIRED
|
159
|
-
LABEL_REPEATED
|
160
|
-
|
161
|
-
};
|
174
|
+
LABEL_OPTIONAL = 1;
|
175
|
+
LABEL_REQUIRED = 2;
|
176
|
+
LABEL_REPEATED = 3;
|
177
|
+
}
|
162
178
|
|
163
179
|
optional string name = 1;
|
164
180
|
optional int32 number = 3;
|
@@ -197,11 +213,35 @@ message FieldDescriptorProto {
|
|
197
213
|
optional string json_name = 10;
|
198
214
|
|
199
215
|
optional FieldOptions options = 8;
|
216
|
+
|
217
|
+
// If true, this is a proto3 "optional". When a proto3 field is optional, it
|
218
|
+
// tracks presence regardless of field type.
|
219
|
+
//
|
220
|
+
// When proto3_optional is true, this field must be belong to a oneof to
|
221
|
+
// signal to old proto3 clients that presence is tracked for this field. This
|
222
|
+
// oneof is known as a "synthetic" oneof, and this field must be its sole
|
223
|
+
// member (each proto3 optional field gets its own synthetic oneof). Synthetic
|
224
|
+
// oneofs exist in the descriptor only, and do not generate any API. Synthetic
|
225
|
+
// oneofs must be ordered after all "real" oneofs.
|
226
|
+
//
|
227
|
+
// For message fields, proto3_optional doesn't create any semantic change,
|
228
|
+
// since non-repeated message fields always track presence. However it still
|
229
|
+
// indicates the semantic detail of whether the user wrote "optional" or not.
|
230
|
+
// This can be useful for round-tripping the .proto file. For consistency we
|
231
|
+
// give message fields a synthetic oneof also, even though it is not required
|
232
|
+
// to track presence. This is especially important because the parser can't
|
233
|
+
// tell if a field is a message or an enum, so it must always create a
|
234
|
+
// synthetic oneof.
|
235
|
+
//
|
236
|
+
// Proto2 optional fields do not set this flag, because they already indicate
|
237
|
+
// optional with `LABEL_OPTIONAL`.
|
238
|
+
optional bool proto3_optional = 17;
|
200
239
|
}
|
201
240
|
|
202
241
|
// Describes a oneof.
|
203
242
|
message OneofDescriptorProto {
|
204
243
|
optional string name = 1;
|
244
|
+
optional OneofOptions options = 2;
|
205
245
|
}
|
206
246
|
|
207
247
|
// Describes an enum type.
|
@@ -211,6 +251,26 @@ message EnumDescriptorProto {
|
|
211
251
|
repeated EnumValueDescriptorProto value = 2;
|
212
252
|
|
213
253
|
optional EnumOptions options = 3;
|
254
|
+
|
255
|
+
// Range of reserved numeric values. Reserved values may not be used by
|
256
|
+
// entries in the same enum. Reserved ranges may not overlap.
|
257
|
+
//
|
258
|
+
// Note that this is distinct from DescriptorProto.ReservedRange in that it
|
259
|
+
// is inclusive such that it can appropriately represent the entire int32
|
260
|
+
// domain.
|
261
|
+
message EnumReservedRange {
|
262
|
+
optional int32 start = 1; // Inclusive.
|
263
|
+
optional int32 end = 2; // Inclusive.
|
264
|
+
}
|
265
|
+
|
266
|
+
// Range of reserved numeric values. Reserved numeric values may not be used
|
267
|
+
// by enum values in the same enum declaration. Reserved ranges may not
|
268
|
+
// overlap.
|
269
|
+
repeated EnumReservedRange reserved_range = 4;
|
270
|
+
|
271
|
+
// Reserved enum value names, which may not be reused. A given name may only
|
272
|
+
// be reserved once.
|
273
|
+
repeated string reserved_name = 5;
|
214
274
|
}
|
215
275
|
|
216
276
|
// Describes a value within an enum.
|
@@ -241,9 +301,9 @@ message MethodDescriptorProto {
|
|
241
301
|
optional MethodOptions options = 4;
|
242
302
|
|
243
303
|
// Identifies if client streams multiple client messages
|
244
|
-
optional bool client_streaming = 5 [default=false];
|
304
|
+
optional bool client_streaming = 5 [default = false];
|
245
305
|
// Identifies if server streams multiple server messages
|
246
|
-
optional bool server_streaming = 6 [default=false];
|
306
|
+
optional bool server_streaming = 6 [default = false];
|
247
307
|
}
|
248
308
|
|
249
309
|
|
@@ -279,7 +339,6 @@ message MethodDescriptorProto {
|
|
279
339
|
// If this turns out to be popular, a web service will be set up
|
280
340
|
// to automatically assign option numbers.
|
281
341
|
|
282
|
-
|
283
342
|
message FileOptions {
|
284
343
|
|
285
344
|
// Sets the Java package where classes generated from this .proto will be
|
@@ -289,34 +348,23 @@ message FileOptions {
|
|
289
348
|
optional string java_package = 1;
|
290
349
|
|
291
350
|
|
292
|
-
//
|
293
|
-
//
|
294
|
-
//
|
295
|
-
//
|
296
|
-
//
|
351
|
+
// Controls the name of the wrapper Java class generated for the .proto file.
|
352
|
+
// That class will always contain the .proto file's getDescriptor() method as
|
353
|
+
// well as any top-level extensions defined in the .proto file.
|
354
|
+
// If java_multiple_files is disabled, then all the other classes from the
|
355
|
+
// .proto file will be nested inside the single wrapper outer class.
|
297
356
|
optional string java_outer_classname = 8;
|
298
357
|
|
299
|
-
// If
|
358
|
+
// If enabled, then the Java code generator will generate a separate .java
|
300
359
|
// file for each top-level message, enum, and service defined in the .proto
|
301
|
-
// file. Thus, these types will *not* be nested inside the
|
302
|
-
// named by java_outer_classname. However, the
|
360
|
+
// file. Thus, these types will *not* be nested inside the wrapper class
|
361
|
+
// named by java_outer_classname. However, the wrapper class will still be
|
303
362
|
// generated to contain the file's getDescriptor() method as well as any
|
304
363
|
// top-level extensions defined in the file.
|
305
|
-
optional bool java_multiple_files = 10 [default=false];
|
306
|
-
|
307
|
-
//
|
308
|
-
|
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];
|
364
|
+
optional bool java_multiple_files = 10 [default = false];
|
365
|
+
|
366
|
+
// This option does nothing.
|
367
|
+
optional bool java_generate_equals_and_hash = 20 [deprecated=true];
|
320
368
|
|
321
369
|
// If set true, then the Java2 code generator will generate code that
|
322
370
|
// throws an exception whenever an attempt is made to assign a non-UTF-8
|
@@ -324,17 +372,17 @@ message FileOptions {
|
|
324
372
|
// Message reflection will do the same.
|
325
373
|
// However, an extension field still accepts non-UTF-8 byte sequences.
|
326
374
|
// This option has no effect on when used with the lite runtime.
|
327
|
-
optional bool java_string_check_utf8 = 27 [default=false];
|
375
|
+
optional bool java_string_check_utf8 = 27 [default = false];
|
328
376
|
|
329
377
|
|
330
378
|
// Generated classes can be optimized for speed or code size.
|
331
379
|
enum OptimizeMode {
|
332
|
-
SPEED = 1;
|
333
|
-
|
334
|
-
CODE_SIZE = 2;
|
335
|
-
LITE_RUNTIME = 3;
|
380
|
+
SPEED = 1; // Generate complete code for parsing, serialization,
|
381
|
+
// etc.
|
382
|
+
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
383
|
+
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
336
384
|
}
|
337
|
-
optional OptimizeMode optimize_for = 9 [default=SPEED];
|
385
|
+
optional OptimizeMode optimize_for = 9 [default = SPEED];
|
338
386
|
|
339
387
|
// Sets the Go package where structs generated from this .proto will be
|
340
388
|
// placed. If omitted, the Go package will be derived from the following:
|
@@ -345,6 +393,7 @@ message FileOptions {
|
|
345
393
|
|
346
394
|
|
347
395
|
|
396
|
+
|
348
397
|
// Should generic services be generated in each language? "Generic" services
|
349
398
|
// are not specific to any particular RPC system. They are generated by the
|
350
399
|
// main code generators in each language (without additional plugins).
|
@@ -355,19 +404,20 @@ message FileOptions {
|
|
355
404
|
// that generate code specific to your particular RPC system. Therefore,
|
356
405
|
// these default to false. Old code which depends on generic services should
|
357
406
|
// 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];
|
407
|
+
optional bool cc_generic_services = 16 [default = false];
|
408
|
+
optional bool java_generic_services = 17 [default = false];
|
409
|
+
optional bool py_generic_services = 18 [default = false];
|
410
|
+
optional bool php_generic_services = 42 [default = false];
|
361
411
|
|
362
412
|
// Is this file deprecated?
|
363
413
|
// Depending on the target platform, this can emit Deprecated annotations
|
364
414
|
// for everything in the file, or it will be completely ignored; in the very
|
365
415
|
// least, this is a formalization for deprecating files.
|
366
|
-
optional bool deprecated = 23 [default=false];
|
416
|
+
optional bool deprecated = 23 [default = false];
|
367
417
|
|
368
418
|
// Enables the use of arenas for the proto messages in this file. This applies
|
369
419
|
// only to generated classes for C++.
|
370
|
-
optional bool cc_enable_arenas = 31 [default=
|
420
|
+
optional bool cc_enable_arenas = 31 [default = true];
|
371
421
|
|
372
422
|
|
373
423
|
// Sets the objective c class prefix which is prepended to all objective c
|
@@ -377,15 +427,41 @@ message FileOptions {
|
|
377
427
|
// Namespace for generated classes; defaults to the package.
|
378
428
|
optional string csharp_namespace = 37;
|
379
429
|
|
380
|
-
//
|
381
|
-
//
|
382
|
-
|
430
|
+
// By default Swift generators will take the proto package and CamelCase it
|
431
|
+
// replacing '.' with underscore and use that to prefix the types/symbols
|
432
|
+
// defined. When this options is provided, they will use this value instead
|
433
|
+
// to prefix the types/symbols defined.
|
434
|
+
optional string swift_prefix = 39;
|
383
435
|
|
384
|
-
//
|
436
|
+
// Sets the php class prefix which is prepended to all php generated classes
|
437
|
+
// from this .proto. Default is empty.
|
438
|
+
optional string php_class_prefix = 40;
|
439
|
+
|
440
|
+
// Use this option to change the namespace of php generated classes. Default
|
441
|
+
// is empty. When this option is empty, the package name will be used for
|
442
|
+
// determining the namespace.
|
443
|
+
optional string php_namespace = 41;
|
444
|
+
|
445
|
+
// Use this option to change the namespace of php generated metadata classes.
|
446
|
+
// Default is empty. When this option is empty, the proto file name will be
|
447
|
+
// used for determining the namespace.
|
448
|
+
optional string php_metadata_namespace = 44;
|
449
|
+
|
450
|
+
// Use this option to change the package of ruby generated classes. Default
|
451
|
+
// is empty. When this option is not set, the package name will be used for
|
452
|
+
// determining the ruby package.
|
453
|
+
optional string ruby_package = 45;
|
454
|
+
|
455
|
+
|
456
|
+
// The parser stores options it doesn't recognize here.
|
457
|
+
// See the documentation for the "Options" section above.
|
385
458
|
repeated UninterpretedOption uninterpreted_option = 999;
|
386
459
|
|
387
|
-
// Clients can define custom options in extensions of this message.
|
460
|
+
// Clients can define custom options in extensions of this message.
|
461
|
+
// See the documentation for the "Options" section above.
|
388
462
|
extensions 1000 to max;
|
463
|
+
|
464
|
+
reserved 38;
|
389
465
|
}
|
390
466
|
|
391
467
|
message MessageOptions {
|
@@ -407,18 +483,20 @@ message MessageOptions {
|
|
407
483
|
//
|
408
484
|
// Because this is an option, the above two restrictions are not enforced by
|
409
485
|
// the protocol compiler.
|
410
|
-
optional bool message_set_wire_format = 1 [default=false];
|
486
|
+
optional bool message_set_wire_format = 1 [default = false];
|
411
487
|
|
412
488
|
// Disables the generation of the standard "descriptor()" accessor, which can
|
413
489
|
// conflict with a field of the same name. This is meant to make migration
|
414
490
|
// from proto1 easier; new code should avoid fields named "descriptor".
|
415
|
-
optional bool no_standard_descriptor_accessor = 2 [default=false];
|
491
|
+
optional bool no_standard_descriptor_accessor = 2 [default = false];
|
416
492
|
|
417
493
|
// Is this message deprecated?
|
418
494
|
// Depending on the target platform, this can emit Deprecated annotations
|
419
495
|
// for the message, or it will be completely ignored; in the very least,
|
420
496
|
// this is a formalization for deprecating messages.
|
421
|
-
optional bool deprecated = 3 [default=false];
|
497
|
+
optional bool deprecated = 3 [default = false];
|
498
|
+
|
499
|
+
reserved 4, 5, 6;
|
422
500
|
|
423
501
|
// Whether the message is an automatically generated map entry type for the
|
424
502
|
// maps field.
|
@@ -435,7 +513,7 @@ message MessageOptions {
|
|
435
513
|
//
|
436
514
|
// Implementations may choose not to generate the map_entry=true message, but
|
437
515
|
// use a native map in the target language to hold the keys and values.
|
438
|
-
// The reflection APIs in such
|
516
|
+
// The reflection APIs in such implementations still need to work as
|
439
517
|
// if the field is a repeated message field.
|
440
518
|
//
|
441
519
|
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
@@ -443,6 +521,10 @@ message MessageOptions {
|
|
443
521
|
// parser.
|
444
522
|
optional bool map_entry = 7;
|
445
523
|
|
524
|
+
reserved 8; // javalite_serializable
|
525
|
+
reserved 9; // javanano_as_lite
|
526
|
+
|
527
|
+
|
446
528
|
// The parser stores options it doesn't recognize here. See above.
|
447
529
|
repeated UninterpretedOption uninterpreted_option = 999;
|
448
530
|
|
@@ -471,16 +553,17 @@ message FieldOptions {
|
|
471
553
|
// false will avoid using packed encoding.
|
472
554
|
optional bool packed = 2;
|
473
555
|
|
474
|
-
|
475
556
|
// The jstype option determines the JavaScript type used for values of the
|
476
557
|
// field. The option is permitted only for 64 bit integral and fixed types
|
477
|
-
// (int64, uint64, sint64, fixed64, sfixed64).
|
478
|
-
// represented as JavaScript
|
479
|
-
// happen when a large value is converted to a floating point JavaScript
|
480
|
-
//
|
481
|
-
//
|
482
|
-
//
|
483
|
-
//
|
558
|
+
// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
|
559
|
+
// is represented as JavaScript string, which avoids loss of precision that
|
560
|
+
// can happen when a large value is converted to a floating point JavaScript.
|
561
|
+
// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
|
562
|
+
// use the JavaScript "number" type. The behavior of the default option
|
563
|
+
// JS_NORMAL is implementation dependent.
|
564
|
+
//
|
565
|
+
// This option is an enum to permit additional types to be added, e.g.
|
566
|
+
// goog.math.Integer.
|
484
567
|
optional JSType jstype = 6 [default = JS_NORMAL];
|
485
568
|
enum JSType {
|
486
569
|
// Use the default type.
|
@@ -512,7 +595,7 @@ message FieldOptions {
|
|
512
595
|
//
|
513
596
|
//
|
514
597
|
// Note that implementations may choose not to check required fields within
|
515
|
-
// a lazy sub-message. That is, calling IsInitialized() on the
|
598
|
+
// a lazy sub-message. That is, calling IsInitialized() on the outer message
|
516
599
|
// may return true even if the inner message has missing required fields.
|
517
600
|
// This is necessary because otherwise the inner message would have to be
|
518
601
|
// parsed in order to perform the check, defeating the purpose of lazy
|
@@ -521,18 +604,28 @@ message FieldOptions {
|
|
521
604
|
// implementation must either *always* check its required fields, or *never*
|
522
605
|
// check its required fields, regardless of whether or not the message has
|
523
606
|
// been parsed.
|
524
|
-
optional bool lazy = 5 [default=false];
|
607
|
+
optional bool lazy = 5 [default = false];
|
525
608
|
|
526
609
|
// Is this field deprecated?
|
527
610
|
// Depending on the target platform, this can emit Deprecated annotations
|
528
611
|
// for accessors, or it will be completely ignored; in the very least, this
|
529
612
|
// is a formalization for deprecating fields.
|
530
|
-
optional bool deprecated = 3 [default=false];
|
613
|
+
optional bool deprecated = 3 [default = false];
|
531
614
|
|
532
615
|
// For Google-internal migration only. Do not use.
|
533
|
-
optional bool weak = 10 [default=false];
|
616
|
+
optional bool weak = 10 [default = false];
|
534
617
|
|
535
618
|
|
619
|
+
// The parser stores options it doesn't recognize here. See above.
|
620
|
+
repeated UninterpretedOption uninterpreted_option = 999;
|
621
|
+
|
622
|
+
// Clients can define custom options in extensions of this message. See above.
|
623
|
+
extensions 1000 to max;
|
624
|
+
|
625
|
+
reserved 4; // removed jtype
|
626
|
+
}
|
627
|
+
|
628
|
+
message OneofOptions {
|
536
629
|
// The parser stores options it doesn't recognize here. See above.
|
537
630
|
repeated UninterpretedOption uninterpreted_option = 999;
|
538
631
|
|
@@ -550,7 +643,9 @@ message EnumOptions {
|
|
550
643
|
// Depending on the target platform, this can emit Deprecated annotations
|
551
644
|
// for the enum, or it will be completely ignored; in the very least, this
|
552
645
|
// is a formalization for deprecating enums.
|
553
|
-
optional bool deprecated = 3 [default=false];
|
646
|
+
optional bool deprecated = 3 [default = false];
|
647
|
+
|
648
|
+
reserved 5; // javanano_as_lite
|
554
649
|
|
555
650
|
// The parser stores options it doesn't recognize here. See above.
|
556
651
|
repeated UninterpretedOption uninterpreted_option = 999;
|
@@ -564,7 +659,7 @@ message EnumValueOptions {
|
|
564
659
|
// Depending on the target platform, this can emit Deprecated annotations
|
565
660
|
// for the enum value, or it will be completely ignored; in the very least,
|
566
661
|
// this is a formalization for deprecating enum values.
|
567
|
-
optional bool deprecated = 1 [default=false];
|
662
|
+
optional bool deprecated = 1 [default = false];
|
568
663
|
|
569
664
|
// The parser stores options it doesn't recognize here. See above.
|
570
665
|
repeated UninterpretedOption uninterpreted_option = 999;
|
@@ -584,7 +679,7 @@ message ServiceOptions {
|
|
584
679
|
// Depending on the target platform, this can emit Deprecated annotations
|
585
680
|
// for the service, or it will be completely ignored; in the very least,
|
586
681
|
// this is a formalization for deprecating services.
|
587
|
-
optional bool deprecated = 33 [default=false];
|
682
|
+
optional bool deprecated = 33 [default = false];
|
588
683
|
|
589
684
|
// The parser stores options it doesn't recognize here. See above.
|
590
685
|
repeated UninterpretedOption uninterpreted_option = 999;
|
@@ -604,7 +699,18 @@ message MethodOptions {
|
|
604
699
|
// Depending on the target platform, this can emit Deprecated annotations
|
605
700
|
// for the method, or it will be completely ignored; in the very least,
|
606
701
|
// this is a formalization for deprecating methods.
|
607
|
-
optional bool deprecated = 33 [default=false];
|
702
|
+
optional bool deprecated = 33 [default = false];
|
703
|
+
|
704
|
+
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
|
705
|
+
// or neither? HTTP based RPC implementation may choose GET verb for safe
|
706
|
+
// methods, and PUT verb for idempotent methods instead of the default POST.
|
707
|
+
enum IdempotencyLevel {
|
708
|
+
IDEMPOTENCY_UNKNOWN = 0;
|
709
|
+
NO_SIDE_EFFECTS = 1; // implies idempotent
|
710
|
+
IDEMPOTENT = 2; // idempotent, but may have side effects
|
711
|
+
}
|
712
|
+
optional IdempotencyLevel idempotency_level = 34
|
713
|
+
[default = IDEMPOTENCY_UNKNOWN];
|
608
714
|
|
609
715
|
// The parser stores options it doesn't recognize here. See above.
|
610
716
|
repeated UninterpretedOption uninterpreted_option = 999;
|
@@ -685,7 +791,7 @@ message SourceCodeInfo {
|
|
685
791
|
// beginning of the "extend" block and is shared by all extensions within
|
686
792
|
// the block.
|
687
793
|
// - Just because a location's span is a subset of some other location's span
|
688
|
-
// does not mean that it is a
|
794
|
+
// does not mean that it is a descendant. For example, a "group" defines
|
689
795
|
// both a type and a field in a single declaration. Thus, the locations
|
690
796
|
// corresponding to the type and field and their components will overlap.
|
691
797
|
// - Code which tries to interpret locations should probably be designed to
|
@@ -716,14 +822,14 @@ message SourceCodeInfo {
|
|
716
822
|
// [ 4, 3, 2, 7 ]
|
717
823
|
// this path refers to the whole field declaration (from the beginning
|
718
824
|
// of the label to the terminating semicolon).
|
719
|
-
repeated int32 path = 1 [packed=true];
|
825
|
+
repeated int32 path = 1 [packed = true];
|
720
826
|
|
721
827
|
// Always has exactly three or four elements: start line, start column,
|
722
828
|
// end line (optional, otherwise assumed same as start line), end column.
|
723
829
|
// These are packed into a single field for efficiency. Note that line
|
724
830
|
// and column numbers are zero-based -- typically you will want to add
|
725
831
|
// 1 to each before displaying to a user.
|
726
|
-
repeated int32 span = 2 [packed=true];
|
832
|
+
repeated int32 span = 2 [packed = true];
|
727
833
|
|
728
834
|
// If this SourceCodeInfo represents a complete declaration, these are any
|
729
835
|
// comments appearing before and after the declaration which appear to be
|
@@ -777,3 +883,29 @@ message SourceCodeInfo {
|
|
777
883
|
repeated string leading_detached_comments = 6;
|
778
884
|
}
|
779
885
|
}
|
886
|
+
|
887
|
+
// Describes the relationship between generated code and its original source
|
888
|
+
// file. A GeneratedCodeInfo message is associated with only one generated
|
889
|
+
// source file, but may contain references to different source .proto files.
|
890
|
+
message GeneratedCodeInfo {
|
891
|
+
// An Annotation connects some span of text in generated code to an element
|
892
|
+
// of its generating .proto file.
|
893
|
+
repeated Annotation annotation = 1;
|
894
|
+
message Annotation {
|
895
|
+
// Identifies the element in the original source .proto file. This field
|
896
|
+
// is formatted the same as SourceCodeInfo.Location.path.
|
897
|
+
repeated int32 path = 1 [packed = true];
|
898
|
+
|
899
|
+
// Identifies the filesystem path to the original source .proto.
|
900
|
+
optional string source_file = 2;
|
901
|
+
|
902
|
+
// Identifies the starting offset in bytes in the generated code
|
903
|
+
// that relates to the identified object.
|
904
|
+
optional int32 begin = 3;
|
905
|
+
|
906
|
+
// Identifies the ending offset in bytes in the generated code that
|
907
|
+
// relates to the identified offset. The end offset should be one past
|
908
|
+
// the last relevant byte (so the length of the text = end - begin).
|
909
|
+
optional int32 end = 4;
|
910
|
+
}
|
911
|
+
}
|
@@ -71,12 +71,23 @@ end
|
|
71
71
|
|
72
72
|
context 'with PB_UPCASE_ENUMS set' do
|
73
73
|
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(true) }
|
74
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(false) }
|
74
75
|
let(:values) { [{ :name => 'boom', :number => 1 }] }
|
75
76
|
|
76
77
|
it 'returns a string with the given enum name in ALL CAPS' do
|
77
78
|
expect(subject.build_value(enum.value.first)).to eq("define :BOOM, 1")
|
78
79
|
end
|
79
80
|
end
|
81
|
+
|
82
|
+
context 'with PB_CAPITALIZE_ENUMS set' do
|
83
|
+
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(false) }
|
84
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(true) }
|
85
|
+
let(:values) { [{ :name => 'boom', :number => 1 }] }
|
86
|
+
|
87
|
+
it 'returns a string with the given enum name in ALL CAPS' do
|
88
|
+
expect(subject.build_value(enum.value.first)).to eq("define :Boom, 1")
|
89
|
+
end
|
90
|
+
end
|
80
91
|
end
|
81
92
|
|
82
93
|
end
|
@@ -67,10 +67,21 @@ RSpec.describe ::Protobuf::Generators::FieldGenerator do
|
|
67
67
|
let(:type_name) { '.foo.bar.Baz' }
|
68
68
|
let(:default_value) { 'quux' }
|
69
69
|
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(true) }
|
70
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(false) }
|
70
71
|
|
71
72
|
specify { expect(subject).to eq " optional ::Foo::Bar::Baz, :foo_bar, 3, :default => ::Foo::Bar::Baz::QUUX\n" }
|
72
73
|
end
|
73
74
|
|
75
|
+
context 'when type is an enum with lowercase default value with PB_CAPITALIZE_ENUMS set' do
|
76
|
+
let(:type_enum) { :TYPE_ENUM }
|
77
|
+
let(:type_name) { '.foo.bar.Baz' }
|
78
|
+
let(:default_value) { 'quux' }
|
79
|
+
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(false) }
|
80
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(true) }
|
81
|
+
|
82
|
+
specify { expect(subject).to eq " optional ::Foo::Bar::Baz, :foo_bar, 3, :default => ::Foo::Bar::Baz::Quux\n" }
|
83
|
+
end
|
84
|
+
|
74
85
|
context 'when the type is a string' do
|
75
86
|
let(:type_enum) { :TYPE_STRING }
|
76
87
|
let(:default_value) { "a default \"string\"" }
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
|
4
4
|
let(:app) { proc { |env| env } }
|
5
|
-
let(:env) { Protobuf::Rpc::Env.new }
|
5
|
+
let(:env) { Protobuf::Rpc::Env.new("server" => "cooldude") }
|
6
6
|
|
7
7
|
subject { described_class.new(app) }
|
8
8
|
|
@@ -17,7 +17,7 @@ RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "when exceptions occur" do
|
20
|
-
let(:encoded_error) { error.encode }
|
20
|
+
let(:encoded_error) { error.encode(:server => "cooldude") }
|
21
21
|
let(:error) { Protobuf::Rpc::MethodNotFound.new('Boom!') }
|
22
22
|
|
23
23
|
before { allow(app).to receive(:call).and_raise(error, 'Boom!') }
|
@@ -42,7 +42,7 @@ RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
context "when exception is not a Protobuf error" do
|
45
|
-
let(:encoded_error) { error.encode }
|
45
|
+
let(:encoded_error) { error.encode(:server => "cooldude") }
|
46
46
|
let(:error) { Protobuf::Rpc::RpcFailed.new('Boom!') }
|
47
47
|
|
48
48
|
before { allow(app).to receive(:call).and_raise(RuntimeError, 'Boom!') }
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.10.
|
4
|
+
version: 3.10.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
8
8
|
- Brandon Dewitt
|
9
9
|
- Devin Christensen
|
10
10
|
- Adam Hutchison
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2022-08-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -471,7 +471,7 @@ homepage: https://github.com/localshred/protobuf
|
|
471
471
|
licenses:
|
472
472
|
- MIT
|
473
473
|
metadata: {}
|
474
|
-
post_install_message:
|
474
|
+
post_install_message:
|
475
475
|
rdoc_options: []
|
476
476
|
require_paths:
|
477
477
|
- lib
|
@@ -486,8 +486,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
486
|
- !ruby/object:Gem::Version
|
487
487
|
version: '0'
|
488
488
|
requirements: []
|
489
|
-
rubygems_version: 3.
|
490
|
-
signing_key:
|
489
|
+
rubygems_version: 3.1.4
|
490
|
+
signing_key:
|
491
491
|
specification_version: 4
|
492
492
|
summary: Google Protocol Buffers serialization and RPC implementation for Ruby.
|
493
493
|
test_files:
|