diff --git a/Sources/CreateAPI/Generator/Templates.swift b/Sources/CreateAPI/Generator/Templates.swift index ffb121a6..3d9a465d 100644 --- a/Sources/CreateAPI/Generator/Templates.swift +++ b/Sources/CreateAPI/Generator/Templates.swift @@ -256,15 +256,8 @@ final class Templates { func decode(property: Property, isUsingCodingKeys: Bool, includeDefaultValues: Bool) -> String { let decode = property.isOptional ? "decodeIfPresent" : "decode" let key = isUsingCodingKeys ? ".\(property.name)" : "\"\(property.key)\"" - let statement = "self.\(property.name.accessor) = try values.\(decode)(\(property.type).self, forKey: \(key))" - guard includeDefaultValues else { return statement } - var defaultValue = "" - if property.isOptional, let value = property.defaultValue { - defaultValue = " ?? \(value)" - } - - return "\(statement)\(defaultValue)" + return "self.\(property.name.accessor) = try values.\(decode)(\(property.type).self, forKey: \(key))" } /// Generated decoding of the directly inlined nested object. @@ -290,11 +283,7 @@ final class Templates { func initFromDecoderAnyOf(properties: [Property], includeDefaultValues: Bool) -> String { let contents = properties.map { - let statement = "try? container.decode(\($0.type).self)" - guard includeDefaultValues && $0.isOptional, let defaultValue = $0.defaultValue else { - return "self.\($0.name.accessor) = \(statement)" - } - return "self.\($0.name.accessor) = (\(statement)) ?? \(defaultValue)" + return "self.\($0.name.accessor) = try? container.decode(\($0.type).self)" }.joined(separator: "\n") return """ \(access)init(from decoder: Decoder) throws { diff --git a/Tests/Support/Snapshots/OctoKit/Sources/Entities/DeploymentStatus.swift b/Tests/Support/Snapshots/OctoKit/Sources/Entities/DeploymentStatus.swift index 4ca8e9ef..3663dac3 100644 --- a/Tests/Support/Snapshots/OctoKit/Sources/Entities/DeploymentStatus.swift +++ b/Tests/Support/Snapshots/OctoKit/Sources/Entities/DeploymentStatus.swift @@ -89,7 +89,7 @@ public struct DeploymentStatus: Codable { self.state = try values.decode(State.self, forKey: "state") self.creator = try values.decodeIfPresent(SimpleUser.self, forKey: "creator") self.description = try values.decode(String.self, forKey: "description") - self.environment = try values.decodeIfPresent(String.self, forKey: "environment") ?? "" + self.environment = try values.decodeIfPresent(String.self, forKey: "environment") self.targetURL = try values.decode(URL.self, forKey: "target_url") self.createdAt = try values.decode(Date.self, forKey: "created_at") self.updatedAt = try values.decode(Date.self, forKey: "updated_at") diff --git a/Tests/Support/Snapshots/OctoKit/Sources/Entities/FullRepository.swift b/Tests/Support/Snapshots/OctoKit/Sources/Entities/FullRepository.swift index 422d4837..fb82d51e 100644 --- a/Tests/Support/Snapshots/OctoKit/Sources/Entities/FullRepository.swift +++ b/Tests/Support/Snapshots/OctoKit/Sources/Entities/FullRepository.swift @@ -481,7 +481,7 @@ public struct FullRepository: Codable { self.masterBranch = try values.decodeIfPresent(String.self, forKey: "master_branch") self.openIssues = try values.decode(Int.self, forKey: "open_issues") self.watchers = try values.decode(Int.self, forKey: "watchers") - self.isAnonymousAccessEnabled = try values.decodeIfPresent(Bool.self, forKey: "anonymous_access_enabled") ?? true + self.isAnonymousAccessEnabled = try values.decodeIfPresent(Bool.self, forKey: "anonymous_access_enabled") self.codeOfConduct = try values.decodeIfPresent(CodeOfConductSimple.self, forKey: "code_of_conduct") self.securityAndAnalysis = try values.decodeIfPresent(SecurityAndAnalysis.self, forKey: "security_and_analysis") } diff --git a/Tests/Support/Snapshots/OctoKit/Sources/Entities/PullRequestReviewComment.swift b/Tests/Support/Snapshots/OctoKit/Sources/Entities/PullRequestReviewComment.swift index 870c22b9..89296b63 100644 --- a/Tests/Support/Snapshots/OctoKit/Sources/Entities/PullRequestReviewComment.swift +++ b/Tests/Support/Snapshots/OctoKit/Sources/Entities/PullRequestReviewComment.swift @@ -235,10 +235,10 @@ public struct PullRequestReviewComment: Codable { self.links = try values.decode(Links.self, forKey: "_links") self.startLine = try values.decodeIfPresent(Int.self, forKey: "start_line") self.originalStartLine = try values.decodeIfPresent(Int.self, forKey: "original_start_line") - self.startSide = try values.decodeIfPresent(StartSide.self, forKey: "start_side") ?? .right + self.startSide = try values.decodeIfPresent(StartSide.self, forKey: "start_side") self.line = try values.decodeIfPresent(Int.self, forKey: "line") self.originalLine = try values.decodeIfPresent(Int.self, forKey: "original_line") - self.side = try values.decodeIfPresent(Side.self, forKey: "side") ?? .right + self.side = try values.decodeIfPresent(Side.self, forKey: "side") self.reactions = try values.decodeIfPresent(ReactionRollup.self, forKey: "reactions") self.bodyHTML = try values.decodeIfPresent(String.self, forKey: "body_html") self.bodyText = try values.decodeIfPresent(String.self, forKey: "body_text") diff --git a/Tests/Support/Snapshots/OctoKit/Sources/Entities/Repository.swift b/Tests/Support/Snapshots/OctoKit/Sources/Entities/Repository.swift index fa6effdc..2102b28c 100644 --- a/Tests/Support/Snapshots/OctoKit/Sources/Entities/Repository.swift +++ b/Tests/Support/Snapshots/OctoKit/Sources/Entities/Repository.swift @@ -852,7 +852,7 @@ public struct Repository: Codable { self.size = try values.decode(Int.self, forKey: "size") self.defaultBranch = try values.decode(String.self, forKey: "default_branch") self.openIssuesCount = try values.decode(Int.self, forKey: "open_issues_count") - self.isTemplate = try values.decodeIfPresent(Bool.self, forKey: "is_template") ?? false + self.isTemplate = try values.decodeIfPresent(Bool.self, forKey: "is_template") self.topics = try values.decodeIfPresent([String].self, forKey: "topics") self.hasIssues = try values.decode(Bool.self, forKey: "has_issues") self.hasProjects = try values.decode(Bool.self, forKey: "has_projects") @@ -861,17 +861,17 @@ public struct Repository: Codable { self.hasDownloads = try values.decode(Bool.self, forKey: "has_downloads") self.isArchived = try values.decode(Bool.self, forKey: "archived") self.isDisabled = try values.decode(Bool.self, forKey: "disabled") - self.visibility = try values.decodeIfPresent(String.self, forKey: "visibility") ?? "public" + self.visibility = try values.decodeIfPresent(String.self, forKey: "visibility") self.pushedAt = try values.decodeIfPresent(Date.self, forKey: "pushed_at") self.createdAt = try values.decodeIfPresent(Date.self, forKey: "created_at") self.updatedAt = try values.decodeIfPresent(Date.self, forKey: "updated_at") - self.allowRebaseMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_rebase_merge") ?? true + self.allowRebaseMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_rebase_merge") self.templateRepository = try values.decodeIfPresent(TemplateRepository.self, forKey: "template_repository") self.tempCloneToken = try values.decodeIfPresent(String.self, forKey: "temp_clone_token") - self.allowSquashMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_squash_merge") ?? true - self.allowAutoMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_auto_merge") ?? false - self.deleteBranchOnMerge = try values.decodeIfPresent(Bool.self, forKey: "delete_branch_on_merge") ?? false - self.allowMergeCommit = try values.decodeIfPresent(Bool.self, forKey: "allow_merge_commit") ?? true + self.allowSquashMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_squash_merge") + self.allowAutoMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_auto_merge") + self.deleteBranchOnMerge = try values.decodeIfPresent(Bool.self, forKey: "delete_branch_on_merge") + self.allowMergeCommit = try values.decodeIfPresent(Bool.self, forKey: "allow_merge_commit") self.allowForking = try values.decodeIfPresent(Bool.self, forKey: "allow_forking") self.subscribersCount = try values.decodeIfPresent(Int.self, forKey: "subscribers_count") self.networkCount = try values.decodeIfPresent(Int.self, forKey: "network_count") diff --git a/Tests/Support/Snapshots/OctoKit/Sources/Entities/ReviewComment.swift b/Tests/Support/Snapshots/OctoKit/Sources/Entities/ReviewComment.swift index 7c3fea4b..1f997ee9 100644 --- a/Tests/Support/Snapshots/OctoKit/Sources/Entities/ReviewComment.swift +++ b/Tests/Support/Snapshots/OctoKit/Sources/Entities/ReviewComment.swift @@ -163,8 +163,8 @@ public struct ReviewComment: Codable { self.bodyText = try values.decodeIfPresent(String.self, forKey: "body_text") self.bodyHTML = try values.decodeIfPresent(String.self, forKey: "body_html") self.reactions = try values.decodeIfPresent(ReactionRollup.self, forKey: "reactions") - self.side = try values.decodeIfPresent(Side.self, forKey: "side") ?? .right - self.startSide = try values.decodeIfPresent(StartSide.self, forKey: "start_side") ?? .right + self.side = try values.decodeIfPresent(Side.self, forKey: "side") + self.startSide = try values.decodeIfPresent(StartSide.self, forKey: "start_side") self.line = try values.decodeIfPresent(Int.self, forKey: "line") self.originalLine = try values.decodeIfPresent(Int.self, forKey: "original_line") self.startLine = try values.decodeIfPresent(Int.self, forKey: "start_line") diff --git a/Tests/Support/Snapshots/OctoKit/Sources/Entities/TeamRepository.swift b/Tests/Support/Snapshots/OctoKit/Sources/Entities/TeamRepository.swift index f3d026f5..186c6e41 100644 --- a/Tests/Support/Snapshots/OctoKit/Sources/Entities/TeamRepository.swift +++ b/Tests/Support/Snapshots/OctoKit/Sources/Entities/TeamRepository.swift @@ -392,7 +392,7 @@ public struct TeamRepository: Codable { self.size = try values.decode(Int.self, forKey: "size") self.defaultBranch = try values.decode(String.self, forKey: "default_branch") self.openIssuesCount = try values.decode(Int.self, forKey: "open_issues_count") - self.isTemplate = try values.decodeIfPresent(Bool.self, forKey: "is_template") ?? false + self.isTemplate = try values.decodeIfPresent(Bool.self, forKey: "is_template") self.topics = try values.decodeIfPresent([String].self, forKey: "topics") self.hasIssues = try values.decode(Bool.self, forKey: "has_issues") self.hasProjects = try values.decode(Bool.self, forKey: "has_projects") @@ -401,18 +401,18 @@ public struct TeamRepository: Codable { self.hasDownloads = try values.decode(Bool.self, forKey: "has_downloads") self.isArchived = try values.decode(Bool.self, forKey: "archived") self.isDisabled = try values.decode(Bool.self, forKey: "disabled") - self.visibility = try values.decodeIfPresent(String.self, forKey: "visibility") ?? "public" + self.visibility = try values.decodeIfPresent(String.self, forKey: "visibility") self.pushedAt = try values.decodeIfPresent(Date.self, forKey: "pushed_at") self.createdAt = try values.decodeIfPresent(Date.self, forKey: "created_at") self.updatedAt = try values.decodeIfPresent(Date.self, forKey: "updated_at") - self.allowRebaseMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_rebase_merge") ?? true + self.allowRebaseMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_rebase_merge") self.templateRepository = try values.decodeIfPresent(Repository.self, forKey: "template_repository") self.tempCloneToken = try values.decodeIfPresent(String.self, forKey: "temp_clone_token") - self.allowSquashMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_squash_merge") ?? true - self.allowAutoMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_auto_merge") ?? false - self.deleteBranchOnMerge = try values.decodeIfPresent(Bool.self, forKey: "delete_branch_on_merge") ?? false - self.allowMergeCommit = try values.decodeIfPresent(Bool.self, forKey: "allow_merge_commit") ?? true - self.allowForking = try values.decodeIfPresent(Bool.self, forKey: "allow_forking") ?? false + self.allowSquashMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_squash_merge") + self.allowAutoMerge = try values.decodeIfPresent(Bool.self, forKey: "allow_auto_merge") + self.deleteBranchOnMerge = try values.decodeIfPresent(Bool.self, forKey: "delete_branch_on_merge") + self.allowMergeCommit = try values.decodeIfPresent(Bool.self, forKey: "allow_merge_commit") + self.allowForking = try values.decodeIfPresent(Bool.self, forKey: "allow_forking") self.subscribersCount = try values.decodeIfPresent(Int.self, forKey: "subscribers_count") self.networkCount = try values.decodeIfPresent(Int.self, forKey: "network_count") self.openIssues = try values.decode(Int.self, forKey: "open_issues") diff --git a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Animal.swift index f1e723b8..c56c7e78 100644 --- a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ struct Animal: Codable { init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Cat.swift index 27db8308..5e5b5ce2 100644 --- a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ struct Cat: Codable { init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Dog.swift index bb5c15f4..6a14c761 100644 --- a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ struct Dog: Codable { init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Order.swift index 78fc8c4a..4c763f25 100644 --- a/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-change-access-control/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Dog.swift index 300d3a9c..7a1ef742 100644 --- a/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-coding-keys/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Animal.swift index 46438bdc..06f0a649 100644 --- a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Dog.swift index 300d3a9c..7a1ef742 100644 --- a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/FormatTest.swift b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/FormatTest.swift index e74f9100..4d24a5b5 100644 --- a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/FormatTest.swift +++ b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/FormatTest.swift @@ -56,7 +56,7 @@ public struct FormatTest: Codable { self.binary = try values.decodeIfPresent(Data.self, forKey: "binary") self.uri = try values.decodeIfPresent(String.self, forKey: "uri") self.uriReference = try values.decodeIfPresent(String.self, forKey: "uri_reference") - self.uriDefault = try values.decodeIfPresent(String.self, forKey: "uri_default") ?? "https://www.swift.org/" + self.uriDefault = try values.decodeIfPresent(String.self, forKey: "uri_default") self.uriRequired = try values.decode(String.self, forKey: "uri_required") self.date = try values.decode(NaiveDate.self, forKey: "date") self.dateTime = try values.decodeIfPresent(AnyJSON.self, forKey: "dateTime") diff --git a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Order.swift index 161fc4a2..a72d6c21 100644 --- a/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-data-types/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Double.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(AnyJSON.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Animal.swift index 46438bdc..06f0a649 100644 --- a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Dog.swift index 300d3a9c..7a1ef742 100644 --- a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Order.swift index f8f06ad1..47735e05 100644 --- a/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-default/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Animal.swift index 46438bdc..06f0a649 100644 --- a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Dog.swift index 300d3a9c..7a1ef742 100644 --- a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Order.swift index dd937c40..4c2c5905 100644 --- a/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-disable-acronyms/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Animal.swift index 46438bdc..06f0a649 100644 --- a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Dog.swift index c044049e..ac348cb6 100644 --- a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Dog.swift @@ -24,7 +24,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(String.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(String.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Order.swift index 65fadbc9..fb351305 100644 --- a/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-disable-enums/Sources/Entities/Order.swift @@ -29,7 +29,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(String.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Animal.swift index df683208..1fb80a68 100644 --- a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Cat.swift index c9e9d359..887d8125 100644 --- a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Dog.swift index f2ab695f..8045cf2a 100644 --- a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Order.swift index 021eaea6..4d77149a 100644 --- a/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-indent-with-two-width-spaces/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Animal.swift index 46438bdc..06f0a649 100644 --- a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Dog.swift index 300d3a9c..7a1ef742 100644 --- a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Order.swift index 98628c59..c95721e8 100644 --- a/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-rename-properties/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isDone = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isDone = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Animal.swift index 46438bdc..06f0a649 100644 --- a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Dog.swift index 300d3a9c..7a1ef742 100644 --- a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Order.swift index f8f06ad1..47735e05 100644 --- a/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-rename/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Animal.swift index a570e3f9..d4d628ab 100644 --- a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Cat.swift index 186e57e5..3814efd0 100644 --- a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Dog.swift index 47b7fae4..6ae0f334 100644 --- a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Order.swift index a3eab8a4..f0f7bd29 100644 --- a/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-tabs/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isComplete = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Animal.swift b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Animal.swift index 46438bdc..06f0a649 100644 --- a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Animal.swift +++ b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Animal.swift @@ -16,7 +16,7 @@ public struct Animal: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") } public func encode(to encoder: Encoder) throws { diff --git a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Cat.swift b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Cat.swift index 4c59ada6..e0c43a52 100644 --- a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Cat.swift +++ b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Cat.swift @@ -18,7 +18,7 @@ public struct Cat: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.isDeclawed = try values.decodeIfPresent(Bool.self, forKey: "declawed") } diff --git a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Dog.swift b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Dog.swift index 300d3a9c..7a1ef742 100644 --- a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Dog.swift +++ b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Dog.swift @@ -38,7 +38,7 @@ public struct Dog: Codable { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: StringCodingKey.self) self.className = try values.decode(String.self, forKey: "className") - self.color = try values.decodeIfPresent(String.self, forKey: "color") ?? "red" + self.color = try values.decodeIfPresent(String.self, forKey: "color") self.breed = try values.decodeIfPresent(Breed.self, forKey: "breed") self.image = try values.decodeIfPresent(Image.self, forKey: "image") self.goodBoy = try values.decode(GoodBoy.self, forKey: "good_boy") diff --git a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Order.swift b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Order.swift index 98628c59..c95721e8 100644 --- a/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Order.swift +++ b/Tests/Support/Snapshots/edgecases-yaml-config/Sources/Entities/Order.swift @@ -36,7 +36,7 @@ public struct Order: Codable { self.quantity = try values.decodeIfPresent(Int32.self, forKey: "quantity") self.shipDate = try values.decodeIfPresent(Date.self, forKey: "shipDate") self.status = try values.decodeIfPresent(Status.self, forKey: "status") - self.isDone = try values.decodeIfPresent(Bool.self, forKey: "complete") ?? false + self.isDone = try values.decodeIfPresent(Bool.self, forKey: "complete") } public func encode(to encoder: Encoder) throws {