Skip to content

Commit b450f13

Browse files
committed
Sync up the protos with google/protobuf.
Using 239dba535c48b64769cdfdfcb18f771620ccbba9 from their master.
1 parent 3748b30 commit b450f13

18 files changed

+1047
-628
lines changed

Protos/google/protobuf/descriptor.proto

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ option java_package = "com.google.protobuf";
4545
option java_outer_classname = "DescriptorProtos";
4646
option csharp_namespace = "Google.Protobuf.Reflection";
4747
option objc_class_prefix = "GPB";
48+
option cc_enable_arenas = true;
4849

4950
// descriptor.proto must be optimized for speed because reflection-based
5051
// algorithms don't work during bootstrapping.
@@ -225,6 +226,26 @@ message EnumDescriptorProto {
225226
repeated EnumValueDescriptorProto value = 2;
226227

227228
optional EnumOptions options = 3;
229+
230+
// Range of reserved numeric values. Reserved values may not be used by
231+
// entries in the same enum. Reserved ranges may not overlap.
232+
//
233+
// Note that this is distinct from DescriptorProto.ReservedRange in that it
234+
// is inclusive such that it can appropriately represent the entire int32
235+
// domain.
236+
message EnumReservedRange {
237+
optional int32 start = 1; // Inclusive.
238+
optional int32 end = 2; // Inclusive.
239+
}
240+
241+
// Range of reserved numeric values. Reserved numeric values may not be used
242+
// by enum values in the same enum declaration. Reserved ranges may not
243+
// overlap.
244+
repeated EnumReservedRange reserved_range = 4;
245+
246+
// Reserved enum value names, which may not be reused. A given name may only
247+
// be reserved once.
248+
repeated string reserved_name = 5;
228249
}
229250

230251
// Describes a value within an enum.
@@ -361,7 +382,7 @@ message FileOptions {
361382
optional bool cc_generic_services = 16 [default=false];
362383
optional bool java_generic_services = 17 [default=false];
363384
optional bool py_generic_services = 18 [default=false];
364-
optional bool php_generic_services = 19 [default=false];
385+
optional bool php_generic_services = 42 [default=false];
365386

366387
// Is this file deprecated?
367388
// Depending on the target platform, this can emit Deprecated annotations
@@ -396,10 +417,12 @@ message FileOptions {
396417
// determining the namespace.
397418
optional string php_namespace = 41;
398419

399-
// The parser stores options it doesn't recognize here. See above.
420+
// The parser stores options it doesn't recognize here.
421+
// See the documentation for the "Options" section above.
400422
repeated UninterpretedOption uninterpreted_option = 999;
401423

402-
// Clients can define custom options in extensions of this message. See above.
424+
// Clients can define custom options in extensions of this message.
425+
// See the documentation for the "Options" section above.
403426
extensions 1000 to max;
404427

405428
reserved 38;

Protos/google/protobuf/field_mask.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
240240
//
241241
// Note that oneof type names ("test_oneof" in this case) cannot be used in
242242
// paths.
243+
//
244+
// ## Field Mask Verification
245+
//
246+
// The implementation of the all the API methods, which have any FieldMask type
247+
// field in the request, should verify the included field paths, and return
248+
// `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
243249
message FieldMask {
244250
// The set of field mask paths.
245251
repeated string paths = 1;

Protos/google/protobuf/test_messages_proto2.proto

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ message TestAllTypesProto2 {
8181
optional bytes optional_bytes = 15;
8282

8383
optional NestedMessage optional_nested_message = 18;
84-
optional ForeignMessage optional_foreign_message = 19;
84+
optional ForeignMessageProto2 optional_foreign_message = 19;
8585

8686
optional NestedEnum optional_nested_enum = 21;
87-
optional ForeignEnum optional_foreign_enum = 22;
87+
optional ForeignEnumProto2 optional_foreign_enum = 22;
8888

8989
optional string optional_string_piece = 24 [ctype=STRING_PIECE];
9090
optional string optional_cord = 25 [ctype=CORD];
@@ -109,10 +109,10 @@ message TestAllTypesProto2 {
109109
repeated bytes repeated_bytes = 45;
110110

111111
repeated NestedMessage repeated_nested_message = 48;
112-
repeated ForeignMessage repeated_foreign_message = 49;
112+
repeated ForeignMessageProto2 repeated_foreign_message = 49;
113113

114114
repeated NestedEnum repeated_nested_enum = 51;
115-
repeated ForeignEnum repeated_foreign_enum = 52;
115+
repeated ForeignEnumProto2 repeated_foreign_enum = 52;
116116

117117
repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
118118
repeated string repeated_cord = 55 [ctype=CORD];
@@ -134,9 +134,9 @@ message TestAllTypesProto2 {
134134
map < string, string> map_string_string = 69;
135135
map < string, bytes> map_string_bytes = 70;
136136
map < string, NestedMessage> map_string_nested_message = 71;
137-
map < string, ForeignMessage> map_string_foreign_message = 72;
137+
map < string, ForeignMessageProto2> map_string_foreign_message = 72;
138138
map < string, NestedEnum> map_string_nested_enum = 73;
139-
map < string, ForeignEnum> map_string_foreign_enum = 74;
139+
map < string, ForeignEnumProto2> map_string_foreign_enum = 74;
140140

141141
oneof oneof_field {
142142
uint32 oneof_uint32 = 111;
@@ -201,11 +201,11 @@ message TestAllTypesProto2 {
201201
}
202202
}
203203

204-
message ForeignMessage {
204+
message ForeignMessageProto2 {
205205
optional int32 c = 1;
206206
}
207207

208-
enum ForeignEnum {
208+
enum ForeignEnumProto2 {
209209
FOREIGN_FOO = 0;
210210
FOREIGN_BAR = 1;
211211
FOREIGN_BAZ = 2;

Protos/google/protobuf/test_messages_proto3.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ message TestAllTypesProto3 {
215215
int32 field__Name16 = 416;
216216
int32 field_name17__ = 417;
217217
int32 Field_name18__ = 418;
218+
219+
// Reserved for testing unknown fields
220+
reserved 501 to 510;
218221
}
219222

220223
message ForeignMessage {

Protos/google/protobuf/timestamp.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ option objc_class_prefix = "GPB";
114114
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
115115
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
116116
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
117-
// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime())
117+
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--)
118118
// to obtain a formatter capable of generating timestamps in this format.
119119
//
120120
//

Protos/google/protobuf/unittest_proto3_arena.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ message TestUnpackedTypes {
187187
message NestedTestAllTypes {
188188
NestedTestAllTypes child = 1;
189189
TestAllTypes payload = 2;
190+
repeated NestedTestAllTypes repeated_child = 3;
190191
}
191192

192193
// Define these after TestAllTypes to make sure the compiler can handle
@@ -205,4 +206,3 @@ enum ForeignEnum {
205206
// TestEmptyMessage is used to test behavior of unknown fields.
206207
message TestEmptyMessage {
207208
}
208-

Reference/google/protobuf/descriptor.pb.swift

Lines changed: 117 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,88 @@ struct Google_Protobuf_EnumDescriptorProto: SwiftProtobuf.Message {
10401040
/// Clears the value of `options`. Subsequent reads from it will return its default value.
10411041
mutating func clearOptions() {_storage._options = nil}
10421042

1043+
/// Range of reserved numeric values. Reserved numeric values may not be used
1044+
/// by enum values in the same enum declaration. Reserved ranges may not
1045+
/// overlap.
1046+
var reservedRange: [Google_Protobuf_EnumDescriptorProto.EnumReservedRange] {
1047+
get {return _storage._reservedRange}
1048+
set {_uniqueStorage()._reservedRange = newValue}
1049+
}
1050+
1051+
/// Reserved enum value names, which may not be reused. A given name may only
1052+
/// be reserved once.
1053+
var reservedName: [String] {
1054+
get {return _storage._reservedName}
1055+
set {_uniqueStorage()._reservedName = newValue}
1056+
}
1057+
10431058
var unknownFields = SwiftProtobuf.UnknownStorage()
10441059

1060+
/// Range of reserved numeric values. Reserved values may not be used by
1061+
/// entries in the same enum. Reserved ranges may not overlap.
1062+
///
1063+
/// Note that this is distinct from DescriptorProto.ReservedRange in that it
1064+
/// is inclusive such that it can appropriately represent the entire int32
1065+
/// domain.
1066+
struct EnumReservedRange: SwiftProtobuf.Message {
1067+
static let protoMessageName: String = Google_Protobuf_EnumDescriptorProto.protoMessageName + ".EnumReservedRange"
1068+
1069+
/// Inclusive.
1070+
var start: Int32 {
1071+
get {return _start ?? 0}
1072+
set {_start = newValue}
1073+
}
1074+
/// Returns true if `start` has been explicitly set.
1075+
var hasStart: Bool {return self._start != nil}
1076+
/// Clears the value of `start`. Subsequent reads from it will return its default value.
1077+
mutating func clearStart() {self._start = nil}
1078+
1079+
/// Inclusive.
1080+
var end: Int32 {
1081+
get {return _end ?? 0}
1082+
set {_end = newValue}
1083+
}
1084+
/// Returns true if `end` has been explicitly set.
1085+
var hasEnd: Bool {return self._end != nil}
1086+
/// Clears the value of `end`. Subsequent reads from it will return its default value.
1087+
mutating func clearEnd() {self._end = nil}
1088+
1089+
var unknownFields = SwiftProtobuf.UnknownStorage()
1090+
1091+
init() {}
1092+
1093+
/// Used by the decoding initializers in the SwiftProtobuf library, not generally
1094+
/// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
1095+
/// initializers are defined in the SwiftProtobuf library. See the Message and
1096+
/// Message+*Additions` files.
1097+
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
1098+
while let fieldNumber = try decoder.nextFieldNumber() {
1099+
switch fieldNumber {
1100+
case 1: try decoder.decodeSingularInt32Field(value: &self._start)
1101+
case 2: try decoder.decodeSingularInt32Field(value: &self._end)
1102+
default: break
1103+
}
1104+
}
1105+
}
1106+
1107+
/// Used by the encoding methods of the SwiftProtobuf library, not generally
1108+
/// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
1109+
/// other serializer methods are defined in the SwiftProtobuf library. See the
1110+
/// `Message` and `Message+*Additions` files.
1111+
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
1112+
if let v = self._start {
1113+
try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
1114+
}
1115+
if let v = self._end {
1116+
try visitor.visitSingularInt32Field(value: v, fieldNumber: 2)
1117+
}
1118+
try unknownFields.traverse(visitor: &visitor)
1119+
}
1120+
1121+
fileprivate var _start: Int32? = nil
1122+
fileprivate var _end: Int32? = nil
1123+
}
1124+
10451125
init() {}
10461126

10471127
public var isInitialized: Bool {
@@ -1064,6 +1144,8 @@ struct Google_Protobuf_EnumDescriptorProto: SwiftProtobuf.Message {
10641144
case 1: try decoder.decodeSingularStringField(value: &_storage._name)
10651145
case 2: try decoder.decodeRepeatedMessageField(value: &_storage._value)
10661146
case 3: try decoder.decodeSingularMessageField(value: &_storage._options)
1147+
case 4: try decoder.decodeRepeatedMessageField(value: &_storage._reservedRange)
1148+
case 5: try decoder.decodeRepeatedStringField(value: &_storage._reservedName)
10671149
default: break
10681150
}
10691151
}
@@ -1085,6 +1167,12 @@ struct Google_Protobuf_EnumDescriptorProto: SwiftProtobuf.Message {
10851167
if let v = _storage._options {
10861168
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
10871169
}
1170+
if !_storage._reservedRange.isEmpty {
1171+
try visitor.visitRepeatedMessageField(value: _storage._reservedRange, fieldNumber: 4)
1172+
}
1173+
if !_storage._reservedName.isEmpty {
1174+
try visitor.visitRepeatedStringField(value: _storage._reservedName, fieldNumber: 5)
1175+
}
10881176
}
10891177
try unknownFields.traverse(visitor: &visitor)
10901178
}
@@ -1598,7 +1686,8 @@ struct Google_Protobuf_FileOptions: SwiftProtobuf.Message, SwiftProtobuf.Extensi
15981686
/// Clears the value of `phpNamespace`. Subsequent reads from it will return its default value.
15991687
mutating func clearPhpNamespace() {_storage._phpNamespace = nil}
16001688

1601-
/// The parser stores options it doesn't recognize here. See above.
1689+
/// The parser stores options it doesn't recognize here.
1690+
/// See the documentation for the "Options" section above.
16021691
var uninterpretedOption: [Google_Protobuf_UninterpretedOption] {
16031692
get {return _storage._uninterpretedOption}
16041693
set {_uniqueStorage()._uninterpretedOption = newValue}
@@ -1669,7 +1758,6 @@ struct Google_Protobuf_FileOptions: SwiftProtobuf.Message, SwiftProtobuf.Extensi
16691758
case 16: try decoder.decodeSingularBoolField(value: &_storage._ccGenericServices)
16701759
case 17: try decoder.decodeSingularBoolField(value: &_storage._javaGenericServices)
16711760
case 18: try decoder.decodeSingularBoolField(value: &_storage._pyGenericServices)
1672-
case 19: try decoder.decodeSingularBoolField(value: &_storage._phpGenericServices)
16731761
case 20: try decoder.decodeSingularBoolField(value: &_storage._javaGenerateEqualsAndHash)
16741762
case 23: try decoder.decodeSingularBoolField(value: &_storage._deprecated)
16751763
case 27: try decoder.decodeSingularBoolField(value: &_storage._javaStringCheckUtf8)
@@ -1679,6 +1767,7 @@ struct Google_Protobuf_FileOptions: SwiftProtobuf.Message, SwiftProtobuf.Extensi
16791767
case 39: try decoder.decodeSingularStringField(value: &_storage._swiftPrefix)
16801768
case 40: try decoder.decodeSingularStringField(value: &_storage._phpClassPrefix)
16811769
case 41: try decoder.decodeSingularStringField(value: &_storage._phpNamespace)
1770+
case 42: try decoder.decodeSingularBoolField(value: &_storage._phpGenericServices)
16821771
case 999: try decoder.decodeRepeatedMessageField(value: &_storage._uninterpretedOption)
16831772
case 1000..<536870912:
16841773
try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_FileOptions.self, fieldNumber: fieldNumber)
@@ -1718,9 +1807,6 @@ struct Google_Protobuf_FileOptions: SwiftProtobuf.Message, SwiftProtobuf.Extensi
17181807
if let v = _storage._pyGenericServices {
17191808
try visitor.visitSingularBoolField(value: v, fieldNumber: 18)
17201809
}
1721-
if let v = _storage._phpGenericServices {
1722-
try visitor.visitSingularBoolField(value: v, fieldNumber: 19)
1723-
}
17241810
if let v = _storage._javaGenerateEqualsAndHash {
17251811
try visitor.visitSingularBoolField(value: v, fieldNumber: 20)
17261812
}
@@ -1748,6 +1834,9 @@ struct Google_Protobuf_FileOptions: SwiftProtobuf.Message, SwiftProtobuf.Extensi
17481834
if let v = _storage._phpNamespace {
17491835
try visitor.visitSingularStringField(value: v, fieldNumber: 41)
17501836
}
1837+
if let v = _storage._phpGenericServices {
1838+
try visitor.visitSingularBoolField(value: v, fieldNumber: 42)
1839+
}
17511840
if !_storage._uninterpretedOption.isEmpty {
17521841
try visitor.visitRepeatedMessageField(value: _storage._uninterpretedOption, fieldNumber: 999)
17531842
}
@@ -3480,12 +3569,16 @@ extension Google_Protobuf_EnumDescriptorProto: SwiftProtobuf._MessageImplementat
34803569
1: .same(proto: "name"),
34813570
2: .same(proto: "value"),
34823571
3: .same(proto: "options"),
3572+
4: .standard(proto: "reserved_range"),
3573+
5: .standard(proto: "reserved_name"),
34833574
]
34843575

34853576
fileprivate class _StorageClass {
34863577
var _name: String? = nil
34873578
var _value: [Google_Protobuf_EnumValueDescriptorProto] = []
34883579
var _options: Google_Protobuf_EnumOptions? = nil
3580+
var _reservedRange: [Google_Protobuf_EnumDescriptorProto.EnumReservedRange] = []
3581+
var _reservedName: [String] = []
34893582

34903583
static let defaultInstance = _StorageClass()
34913584

@@ -3495,6 +3588,8 @@ extension Google_Protobuf_EnumDescriptorProto: SwiftProtobuf._MessageImplementat
34953588
_name = source._name
34963589
_value = source._value
34973590
_options = source._options
3591+
_reservedRange = source._reservedRange
3592+
_reservedName = source._reservedName
34983593
}
34993594
}
35003595

@@ -3513,6 +3608,8 @@ extension Google_Protobuf_EnumDescriptorProto: SwiftProtobuf._MessageImplementat
35133608
if _storage._name != other_storage._name {return false}
35143609
if _storage._value != other_storage._value {return false}
35153610
if _storage._options != other_storage._options {return false}
3611+
if _storage._reservedRange != other_storage._reservedRange {return false}
3612+
if _storage._reservedName != other_storage._reservedName {return false}
35163613
return true
35173614
}
35183615
if !storagesAreEqual {return false}
@@ -3522,6 +3619,20 @@ extension Google_Protobuf_EnumDescriptorProto: SwiftProtobuf._MessageImplementat
35223619
}
35233620
}
35243621

3622+
extension Google_Protobuf_EnumDescriptorProto.EnumReservedRange: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
3623+
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
3624+
1: .same(proto: "start"),
3625+
2: .same(proto: "end"),
3626+
]
3627+
3628+
func _protobuf_generated_isEqualTo(other: Google_Protobuf_EnumDescriptorProto.EnumReservedRange) -> Bool {
3629+
if self._start != other._start {return false}
3630+
if self._end != other._end {return false}
3631+
if unknownFields != other.unknownFields {return false}
3632+
return true
3633+
}
3634+
}
3635+
35253636
extension Google_Protobuf_EnumValueDescriptorProto: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
35263637
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
35273638
1: .same(proto: "name"),
@@ -3687,7 +3798,7 @@ extension Google_Protobuf_FileOptions: SwiftProtobuf._MessageImplementationBase,
36873798
16: .standard(proto: "cc_generic_services"),
36883799
17: .standard(proto: "java_generic_services"),
36893800
18: .standard(proto: "py_generic_services"),
3690-
19: .standard(proto: "php_generic_services"),
3801+
42: .standard(proto: "php_generic_services"),
36913802
23: .same(proto: "deprecated"),
36923803
31: .standard(proto: "cc_enable_arenas"),
36933804
36: .standard(proto: "objc_class_prefix"),

Reference/google/protobuf/field_mask.pb.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,12 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
249249
///
250250
/// Note that oneof type names ("test_oneof" in this case) cannot be used in
251251
/// paths.
252+
///
253+
/// ## Field Mask Verification
254+
///
255+
/// The implementation of the all the API methods, which have any FieldMask type
256+
/// field in the request, should verify the included field paths, and return
257+
/// `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
252258
struct Google_Protobuf_FieldMask: SwiftProtobuf.Message {
253259
static let protoMessageName: String = _protobuf_package + ".FieldMask"
254260

0 commit comments

Comments
 (0)