Skip to content

Commit fda1c41

Browse files
committed
feat(CustomResult): improve naming
1 parent 10f1d45 commit fda1c41

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Sources/Models/CustomResult.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ extension CustomResult: Encodable {
1111

1212
switch self {
1313
case .success(let value):
14-
try container.encode(value, forKey: .success)
14+
try container.encode(value, forKey: .value)
1515
case .failure(let error):
16-
try container.encode(String(describing: error), forKey: .failure)
16+
try container.encode(String(describing: error), forKey: .error)
1717
}
1818
}
1919

2020
private enum CodingKeys: String, CodingKey {
21-
case success
22-
case failure
21+
case value
22+
case error
2323
}
2424
}
2525

Tests/OutputTests/Printers/JSONPrinterTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extension JSONPrinterTests {
88
@Test
99
func printDependencies() throws {
1010
let expected = """
11-
[{"currentVersionDate":{"success":"1971-08-02T16:53:20Z"},"latestVersion":{"success":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"1","outdated":{"daysOutdated":578,"isOutdated":true},"pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/1.com"},{"currentVersionDate":{"failure":"Error Domain=anyError Code=-1 \\"(null)\\""},"latestVersion":{"success":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"2","pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/2.com"},{"currentVersionDate":{"success":"1971-04-08T23:06:40Z"},"latestVersion":{"failure":"Error Domain=anyError Code=-1 \\"(null)\\""},"name":"3","pointingTo":{"commit":{"hash":"abcd"}},"url":"https:\\/\\/3.com"},{"currentVersionDate":{"failure":"Error Domain=anyError Code=-1 \\"(null)\\""},"latestVersion":{"failure":"Error Domain=anyError Code=-1 \\"(null)\\""},"name":"4","pointingTo":{"commit":{"hash":"abcd"}},"url":"https:\\/\\/4.com"},{"currentVersionDate":{"failure":"Error Domain=anyError Code=-1 \\"(null)\\""},"latestVersion":{"failure":"Error Domain=anyError Code=-1 \\"(null)\\""},"name":"5","pointingTo":{"commit":{"hash":"abcd"}},"url":"https:\\/\\/5.com"},{"currentVersionDate":{"success":"1975-01-26T20:26:40Z"},"latestVersion":{"success":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"6","outdated":{"daysOutdated":0,"isOutdated":false},"pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/6.com"},{"currentVersionDate":{"success":"1970-04-26T17:46:40Z"},"latestVersion":{"success":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"7","outdated":{"daysOutdated":1041,"isOutdated":false},"pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/7.com"}]
11+
[{"currentVersionDate":{"value":"1971-08-02T16:53:20Z"},"latestVersion":{"value":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"1","outdated":{"daysOutdated":578,"isOutdated":true},"pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/1.com"},{"currentVersionDate":{"error":"Error Domain=anyError Code=-1 \\"(null)\\""},"latestVersion":{"value":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"2","pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/2.com"},{"currentVersionDate":{"value":"1971-04-08T23:06:40Z"},"latestVersion":{"error":"Error Domain=anyError Code=-1 \\"(null)\\""},"name":"3","pointingTo":{"commit":{"hash":"abcd"}},"url":"https:\\/\\/3.com"},{"currentVersionDate":{"error":"Error Domain=anyError Code=-1 \\"(null)\\""},"latestVersion":{"error":"Error Domain=anyError Code=-1 \\"(null)\\""},"name":"4","pointingTo":{"commit":{"hash":"abcd"}},"url":"https:\\/\\/4.com"},{"currentVersionDate":{"error":"Error Domain=anyError Code=-1 \\"(null)\\""},"latestVersion":{"error":"Error Domain=anyError Code=-1 \\"(null)\\""},"name":"5","pointingTo":{"commit":{"hash":"abcd"}},"url":"https:\\/\\/5.com"},{"currentVersionDate":{"value":"1975-01-26T20:26:40Z"},"latestVersion":{"value":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"6","outdated":{"daysOutdated":0,"isOutdated":false},"pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/6.com"},{"currentVersionDate":{"value":"1970-04-26T17:46:40Z"},"latestVersion":{"value":{"date":"1973-03-03T09:46:40Z","tag":"v2.0"}},"name":"7","outdated":{"daysOutdated":1041,"isOutdated":false},"pointingTo":{"version":{"version":"1.0.0"}},"url":"https:\\/\\/7.com"}]
1212
"""
1313

1414
let sut = JSONPrinter(defaultPrinter: {

0 commit comments

Comments
 (0)