Skip to content

Commit 53cd963

Browse files
authored
Update upstream protos and regenerate (#792)
* Update the protobuf from protocolbuffers/protobuf. Using commit 37b5617d42d02d225faa1d64565696f5bfb8e61a * Regenerate the sources from the update .proto files. * Update the conformance test for the new enum category. Yes, it changed the values when inserting the new one; an breaking proto change...
1 parent 659025f commit 53cd963

File tree

14 files changed

+409
-139
lines changed

14 files changed

+409
-139
lines changed

Protos/conformance/conformance.proto

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ enum WireFormat {
5858
}
5959

6060
enum TestCategory {
61-
BINARY_TEST = 0; // Test binary wire format.
62-
JSON_TEST = 1; // Test json wire format.
61+
UNSPECIFIED_TEST = 0;
62+
BINARY_TEST = 1; // Test binary wire format.
63+
JSON_TEST = 2; // Test json wire format.
6364
// Similar to JSON_TEST. However, during parsing json, testee should ignore
6465
// unknown fields. This feature is optional. Each implementation can descide
6566
// whether to support it. See
6667
// https://developers.google.com/protocol-buffers/docs/proto3#json_options
6768
// for more detail.
68-
JSON_IGNORE_UNKNOWN_PARSING_TEST = 2;
69+
JSON_IGNORE_UNKNOWN_PARSING_TEST = 3;
6970
}
7071

7172
// Represents a single test case's input. The testee should:
@@ -94,9 +95,9 @@ message ConformanceRequest {
9495
// protobuf_test_messages.proto2.TestAllTypesProto2.
9596
string message_type = 4;
9697

97-
// Each test is given a specific test category. Some category may need spedific
98-
// support in testee programs. Refer to the defintion of TestCategory for
99-
// more information.
98+
// Each test is given a specific test category. Some category may need
99+
// spedific support in testee programs. Refer to the defintion of TestCategory
100+
// for more information.
100101
TestCategory test_category = 5;
101102
}
102103

Protos/google/protobuf/field_mask.proto

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ option java_outer_classname = "FieldMaskProto";
3838
option java_multiple_files = true;
3939
option objc_class_prefix = "GPB";
4040
option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
41+
option cc_enable_arenas = true;
4142

4243
// `FieldMask` represents a set of symbolic field paths, for example:
4344
//
@@ -107,57 +108,49 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
107108
// describe the updated values, the API ignores the values of all
108109
// fields not covered by the mask.
109110
//
110-
// If a repeated field is specified for an update operation, the existing
111-
// repeated values in the target resource will be overwritten by the new values.
112-
// Note that a repeated field is only allowed in the last position of a `paths`
113-
// string.
111+
// If a repeated field is specified for an update operation, new values will
112+
// be appended to the existing repeated field in the target resource. Note that
113+
// a repeated field is only allowed in the last position of a `paths` string.
114114
//
115115
// If a sub-message is specified in the last position of the field mask for an
116-
// update operation, then the existing sub-message in the target resource is
117-
// overwritten. Given the target message:
116+
// update operation, then new value will be merged into the existing sub-message
117+
// in the target resource.
118+
//
119+
// For example, given the target message:
118120
//
119121
// f {
120122
// b {
121-
// d : 1
122-
// x : 2
123+
// d: 1
124+
// x: 2
123125
// }
124-
// c : 1
126+
// c: [1]
125127
// }
126128
//
127129
// And an update message:
128130
//
129131
// f {
130132
// b {
131-
// d : 10
133+
// d: 10
132134
// }
135+
// c: [2]
133136
// }
134137
//
135138
// then if the field mask is:
136139
//
137-
// paths: "f.b"
140+
// paths: ["f.b", "f.c"]
138141
//
139142
// then the result will be:
140143
//
141144
// f {
142145
// b {
143-
// d : 10
146+
// d: 10
147+
// x: 2
144148
// }
145-
// c : 1
149+
// c: [1, 2]
146150
// }
147151
//
148-
// However, if the update mask was:
149-
//
150-
// paths: "f.b.d"
151-
//
152-
// then the result would be:
153-
//
154-
// f {
155-
// b {
156-
// d : 10
157-
// x : 2
158-
// }
159-
// c : 1
160-
// }
152+
// An implementation may provide options to override this default behavior for
153+
// repeated and message fields.
161154
//
162155
// In order to reset a field's value to the default, the field must
163156
// be in the mask and set to the default value in the provided resource.

Protos/google/protobuf/unittest_proto3.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,17 @@ enum ForeignEnum {
206206
message TestEmptyMessage {
207207
}
208208

209+
// Same layout as TestOneof2 in unittest.proto to test unknown enum value
210+
// parsing behavior in oneof.
211+
message TestOneof2 {
212+
oneof foo {
213+
NestedEnum foo_enum = 6;
214+
}
215+
216+
enum NestedEnum {
217+
UNKNOWN = 0;
218+
FOO = 1;
219+
BAR = 2;
220+
BAZ = 3;
221+
}
222+
}

Protos/google/protobuf/wrappers.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
// for embedding primitives in the `google.protobuf.Any` type and for places
3333
// where we need to distinguish between the absence of a primitive
3434
// typed field and its default value.
35+
//
36+
// These wrappers have no meaningful use within repeated fields as they lack
37+
// the ability to detect presence on individual elements.
38+
// These wrappers have no meaningful use within a map or a oneof since individual
39+
// entries of a map or fields of a oneof can already detect presence.
3540

3641
syntax = "proto3";
3742

Reference/conformance/conformance.pb.swift

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,39 +95,42 @@ extension Conformance_WireFormat: CaseIterable {
9595

9696
enum Conformance_TestCategory: SwiftProtobuf.Enum {
9797
typealias RawValue = Int
98+
case unspecifiedTest // = 0
9899

99100
/// Test binary wire format.
100-
case binaryTest // = 0
101+
case binaryTest // = 1
101102

102103
/// Test json wire format.
103-
case jsonTest // = 1
104+
case jsonTest // = 2
104105

105106
/// Similar to JSON_TEST. However, during parsing json, testee should ignore
106107
/// unknown fields. This feature is optional. Each implementation can descide
107108
/// whether to support it. See
108109
/// https://developers.google.com/protocol-buffers/docs/proto3#json_options
109110
/// for more detail.
110-
case jsonIgnoreUnknownParsingTest // = 2
111+
case jsonIgnoreUnknownParsingTest // = 3
111112
case UNRECOGNIZED(Int)
112113

113114
init() {
114-
self = .binaryTest
115+
self = .unspecifiedTest
115116
}
116117

117118
init?(rawValue: Int) {
118119
switch rawValue {
119-
case 0: self = .binaryTest
120-
case 1: self = .jsonTest
121-
case 2: self = .jsonIgnoreUnknownParsingTest
120+
case 0: self = .unspecifiedTest
121+
case 1: self = .binaryTest
122+
case 2: self = .jsonTest
123+
case 3: self = .jsonIgnoreUnknownParsingTest
122124
default: self = .UNRECOGNIZED(rawValue)
123125
}
124126
}
125127

126128
var rawValue: Int {
127129
switch self {
128-
case .binaryTest: return 0
129-
case .jsonTest: return 1
130-
case .jsonIgnoreUnknownParsingTest: return 2
130+
case .unspecifiedTest: return 0
131+
case .binaryTest: return 1
132+
case .jsonTest: return 2
133+
case .jsonIgnoreUnknownParsingTest: return 3
131134
case .UNRECOGNIZED(let i): return i
132135
}
133136
}
@@ -139,6 +142,7 @@ enum Conformance_TestCategory: SwiftProtobuf.Enum {
139142
extension Conformance_TestCategory: CaseIterable {
140143
// The compiler won't synthesize support with the UNRECOGNIZED case.
141144
static var allCases: [Conformance_TestCategory] = [
145+
.unspecifiedTest,
142146
.binaryTest,
143147
.jsonTest,
144148
.jsonIgnoreUnknownParsingTest,
@@ -190,10 +194,10 @@ struct Conformance_ConformanceRequest {
190194
/// protobuf_test_messages.proto2.TestAllTypesProto2.
191195
var messageType: String = String()
192196

193-
/// Each test is given a specific test category. Some category may need spedific
194-
/// support in testee programs. Refer to the defintion of TestCategory for
195-
/// more information.
196-
var testCategory: Conformance_TestCategory = .binaryTest
197+
/// Each test is given a specific test category. Some category may need
198+
/// spedific support in testee programs. Refer to the defintion of TestCategory
199+
/// for more information.
200+
var testCategory: Conformance_TestCategory = .unspecifiedTest
197201

198202
var unknownFields = SwiftProtobuf.UnknownStorage()
199203

@@ -354,9 +358,10 @@ extension Conformance_WireFormat: SwiftProtobuf._ProtoNameProviding {
354358

355359
extension Conformance_TestCategory: SwiftProtobuf._ProtoNameProviding {
356360
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
357-
0: .same(proto: "BINARY_TEST"),
358-
1: .same(proto: "JSON_TEST"),
359-
2: .same(proto: "JSON_IGNORE_UNKNOWN_PARSING_TEST"),
361+
0: .same(proto: "UNSPECIFIED_TEST"),
362+
1: .same(proto: "BINARY_TEST"),
363+
2: .same(proto: "JSON_TEST"),
364+
3: .same(proto: "JSON_IGNORE_UNKNOWN_PARSING_TEST"),
360365
]
361366
}
362367

@@ -405,7 +410,7 @@ extension Conformance_ConformanceRequest: SwiftProtobuf.Message, SwiftProtobuf._
405410
if !self.messageType.isEmpty {
406411
try visitor.visitSingularStringField(value: self.messageType, fieldNumber: 4)
407412
}
408-
if self.testCategory != .binaryTest {
413+
if self.testCategory != .unspecifiedTest {
409414
try visitor.visitSingularEnumField(value: self.testCategory, fieldNumber: 5)
410415
}
411416
try unknownFields.traverse(visitor: &visitor)

Reference/google/protobuf/field_mask.pb.swift

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -116,57 +116,49 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
116116
/// describe the updated values, the API ignores the values of all
117117
/// fields not covered by the mask.
118118
///
119-
/// If a repeated field is specified for an update operation, the existing
120-
/// repeated values in the target resource will be overwritten by the new values.
121-
/// Note that a repeated field is only allowed in the last position of a `paths`
122-
/// string.
119+
/// If a repeated field is specified for an update operation, new values will
120+
/// be appended to the existing repeated field in the target resource. Note that
121+
/// a repeated field is only allowed in the last position of a `paths` string.
123122
///
124123
/// If a sub-message is specified in the last position of the field mask for an
125-
/// update operation, then the existing sub-message in the target resource is
126-
/// overwritten. Given the target message:
124+
/// update operation, then new value will be merged into the existing sub-message
125+
/// in the target resource.
126+
///
127+
/// For example, given the target message:
127128
///
128129
/// f {
129130
/// b {
130-
/// d : 1
131-
/// x : 2
131+
/// d: 1
132+
/// x: 2
132133
/// }
133-
/// c : 1
134+
/// c: [1]
134135
/// }
135136
///
136137
/// And an update message:
137138
///
138139
/// f {
139140
/// b {
140-
/// d : 10
141+
/// d: 10
141142
/// }
143+
/// c: [2]
142144
/// }
143145
///
144146
/// then if the field mask is:
145147
///
146-
/// paths: "f.b"
148+
/// paths: ["f.b", "f.c"]
147149
///
148150
/// then the result will be:
149151
///
150152
/// f {
151153
/// b {
152-
/// d : 10
154+
/// d: 10
155+
/// x: 2
153156
/// }
154-
/// c : 1
157+
/// c: [1, 2]
155158
/// }
156159
///
157-
/// However, if the update mask was:
158-
///
159-
/// paths: "f.b.d"
160-
///
161-
/// then the result would be:
162-
///
163-
/// f {
164-
/// b {
165-
/// d : 10
166-
/// x : 2
167-
/// }
168-
/// c : 1
169-
/// }
160+
/// An implementation may provide options to override this default behavior for
161+
/// repeated and message fields.
170162
///
171163
/// In order to reset a field's value to the default, the field must
172164
/// be in the mask and set to the default value in the provided resource.

0 commit comments

Comments
 (0)