Skip to content

Commit 7d1d71e

Browse files
committed
Make change backwards compatible
1 parent 0a8baa8 commit 7d1d71e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: Sources/SafeDICore/Models/TypeDescription.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ public enum TypeDescription: Codable, Hashable, Comparable, Sendable {
157157
self = .implicitlyUnwrappedOptional(typeDescription)
158158

159159
case Self.compositionDescription:
160-
let typeDescriptions = try values.decode(Set<Self>.self, forKey: .unorderedTypeDescriptions)
160+
let typeDescriptions = try values.decodeIfPresent(Set<Self>.self, forKey: .unorderedTypeDescriptions)
161+
// For backwards compatibility for when compositions were ordered.
162+
// TODO: Delete this backwards compatibility line when we make our next breaking change.
163+
?? values.decode(Set<Self>.self, forKey: .typeDescriptions)
161164
self = .composition(typeDescriptions)
162165

163166
case Self.someDescription:

0 commit comments

Comments
 (0)