You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log?("Will decode \(type) at path \"\(codingPath.path)\"")
188
190
guardlet convertible = type as?ObjectIDConvertible.Typeelse{
189
-
throwDecodingError.typeMismatch(ObjectIDConvertible.self,DecodingError.Context(codingPath: codingPath, debugDescription:"Cannot decode identifer from \(type). Types used as identifiers must conform to \(String(describing:ObjectID.self))"))
191
+
throwDecodingError.typeMismatch(ObjectIDConvertible.self,DecodingError.Context(codingPath: codingPath, debugDescription:"Cannot decode identifer from \(type). Types used as identifiers must conform to \(String(describing:ObjectIDConvertible.self))"))
190
192
}
191
193
letid=self.data.id
192
194
guardlet value = convertible.init(objectID: id)else{
193
195
throwDecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription:"Cannot decode \(type) from identifier \(id)"))
194
196
}
195
197
return value as!T
198
+
}elseiflet relationship =relationships[property]{
199
+
log?("Will decode \(type) at path \"\(codingPath.path)\"")
throwDecodingError.valueNotFound(type,DecodingError.Context(codingPath: codingPath, debugDescription:"Missing relationship value for \(key.stringValue)"))
202
+
}
203
+
switch(relationship.type, relationshipValue){
204
+
case(_,.null):
205
+
//assertionFailure()
206
+
throwDecodingError.valueNotFound(type,DecodingError.Context(codingPath: codingPath, debugDescription:"Expected \(type) value for \(key.stringValue)"))
207
+
case(.toMany,.toMany):
208
+
returntryT.init(from:self)
209
+
case(.toOne,.toOne(let objectID)):
210
+
guardlet convertible = type as?ObjectIDConvertible.Typeelse{
211
+
throwDecodingError.typeMismatch(ObjectIDConvertible.self,DecodingError.Context(codingPath: codingPath, debugDescription:"Cannot decode identifer from \(type). Types used as identifiers must conform to \(String(describing:ObjectIDConvertible.self))"))
212
+
}
213
+
guardlet value = convertible.init(objectID: objectID)else{
214
+
throwDecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription:"Cannot decode \(type) from identifier \(objectID)"))
215
+
}
216
+
return value as!T
217
+
default:
218
+
throwDecodingError.typeMismatch(type,DecodingError.Context(codingPath: codingPath, debugDescription:"Cannot decode relationship from \(type)."))
219
+
}
196
220
}elseiflet decodableType = type as?AttributeDecodable.Type{
0 commit comments