Skip to content

Commit

Permalink
Make change backwards compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Jan 7, 2024
1 parent 42626b8 commit 4cdd5e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/SafeDICore/Models/TypeDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ public enum TypeDescription: Codable, Hashable, Comparable, Sendable {
self = .implicitlyUnwrappedOptional(typeDescription)

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

case Self.someDescription:
Expand Down

0 comments on commit 4cdd5e0

Please sign in to comment.