File tree Expand file tree Collapse file tree
Sources/AblyLiveObjects/Protocol
Tests/AblyLiveObjectsTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,9 +117,13 @@ internal extension ObjectOperation {
117117 counterOp = wireObjectOperation. counterOp
118118 map = wireObjectOperation. map. map { . init( wireMap: $0) }
119119 counter = wireObjectOperation. counter
120- nonce = wireObjectOperation. nonce
121- initialValue = wireObjectOperation. initialValue
122- initialValueEncoding = wireObjectOperation. initialValueEncoding
120+
121+ // Do not access on inbound data, per OOP3g
122+ nonce = nil
123+ // Do not access on inbound data, per OOP3h
124+ initialValue = nil
125+ // Do not access on inbound data, per OOP3i
126+ initialValueEncoding = nil
123127 }
124128
125129 /// Converts this `ObjectOperation` to a `WireObjectOperation`.
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ internal struct WireObjectOperation {
158158 internal var map : WireMap ? // OOP3e
159159 internal var counter : WireCounter ? // OOP3f
160160 internal var nonce : String ? // OOP3g
161- // TODO: Not yet clear how to encode / decode this property; I assume it will be properly specified later. Do in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/12
161+ // TODO: Not yet clear how to encode this property; I assume it will be properly specified later. Do in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/12
162162 internal var initialValue : Data ? // OOP3h
163163 internal var initialValueEncoding : String ? // OOP3i
164164}
@@ -183,8 +183,13 @@ extension WireObjectOperation: WireObjectCodable {
183183 counterOp = try wireObject. optionalDecodableValueForKey ( WireKey . counterOp. rawValue)
184184 map = try wireObject. optionalDecodableValueForKey ( WireKey . map. rawValue)
185185 counter = try wireObject. optionalDecodableValueForKey ( WireKey . counter. rawValue)
186- nonce = try wireObject. optionalStringValueForKey ( WireKey . nonce. rawValue)
187- initialValueEncoding = try wireObject. optionalStringValueForKey ( WireKey . initialValueEncoding. rawValue)
186+
187+ // Do not access on inbound data, per OOP3g
188+ nonce = nil
189+ // Do not access on inbound data, per OOP3h
190+ initialValue = nil
191+ // Do not access on inbound data, per OOP3i
192+ initialValueEncoding = nil
188193 }
189194
190195 internal var toWireObject : [ String : WireValue ] {
Original file line number Diff line number Diff line change @@ -160,6 +160,9 @@ enum WireObjectMessageTests {
160160 }
161161
162162 struct WireObjectOperationTests {
163+ // @spec OOP3g
164+ // @spec OOP3h
165+ // @spec OOP3i
163166 @Test
164167 func decodesAllFields( ) throws {
165168 let wire : [ String : WireValue ] = [
@@ -182,8 +185,13 @@ enum WireObjectMessageTests {
182185 #expect( op. map? . entries ? [ " key1 " ] ? . data. string == " value1 " )
183186 #expect( op. map? . entries ? [ " key1 " ] ? . tombstone == false )
184187 #expect( op. counter? . count == 42 )
185- #expect( op. nonce == " nonce1 " )
186- #expect( op. initialValueEncoding == " utf8 " )
188+
189+ // Per OOP3g we should not try and extract this
190+ #expect( op. nonce == nil )
191+ // Per OOP3h we should not try and extract this
192+ #expect( op. initialValueEncoding == nil )
193+ // Per OOP3i we should not try and extract this
194+ #expect( op. initialValue == nil )
187195 }
188196
189197 @Test
You can’t perform that action at this time.
0 commit comments