From 24305d253b538bc5434d9273bfbfb65621b83e02 Mon Sep 17 00:00:00 2001 From: David Snabel-Caunt Date: Tue, 6 Jun 2017 11:59:52 +0100 Subject: [PATCH] Qualify Argo.Decodable for Swift 3.2 --- Sources/Tentacle/ArgoExtensions.swift | 4 ++-- Sources/Tentacle/Content.swift | 2 +- Sources/Tentacle/Decodable.swift | 2 +- Sources/Tentacle/GitHubError.swift | 2 +- Sources/Tentacle/ResourceType.swift | 2 +- Sources/Tentacle/Tree.swift | 4 ++-- Tests/TentacleTests/Fixture.swift | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/Tentacle/ArgoExtensions.swift b/Sources/Tentacle/ArgoExtensions.swift index 37049c4..ba6c5d6 100644 --- a/Sources/Tentacle/ArgoExtensions.swift +++ b/Sources/Tentacle/ArgoExtensions.swift @@ -37,7 +37,7 @@ extension JSON { } } -internal func decode(_ object: Any) -> Result where T == T.DecodedType { +internal func decode(_ object: Any) -> Result where T == T.DecodedType { let decoded: Decoded = decode(object) switch decoded { case let .success(object): @@ -47,7 +47,7 @@ internal func decode(_ object: Any) -> Result wher } } -internal func decode(_ object: Any) -> Result<[T], DecodeError> where T == T.DecodedType { +internal func decode(_ object: Any) -> Result<[T], DecodeError> where T == T.DecodedType { let decoded: Decoded<[T]> = decode(object) switch decoded { case let .success(object): diff --git a/Sources/Tentacle/Content.swift b/Sources/Tentacle/Content.swift index 6882492..593281f 100644 --- a/Sources/Tentacle/Content.swift +++ b/Sources/Tentacle/Content.swift @@ -102,7 +102,7 @@ func decodeSubmodule(_ j: JSON) -> Decoded { } -extension Content.File.ContentType: Decodable { +extension Content.File.ContentType: Argo.Decodable { public static func decode(_ json: JSON) -> Decoded { guard case let .object(payload) = json else { return .failure(.typeMismatch(expected: "object", actual: "\(json)")) diff --git a/Sources/Tentacle/Decodable.swift b/Sources/Tentacle/Decodable.swift index 5d3d3d1..d3457cd 100644 --- a/Sources/Tentacle/Decodable.swift +++ b/Sources/Tentacle/Decodable.swift @@ -9,7 +9,7 @@ import Argo import Foundation -extension URL: Decodable { +extension URL: Argo.Decodable { public static func decode(_ json: JSON) -> Decoded { return String.decode(json).flatMap { URLString in return .fromOptional(self.init(string: URLString)) diff --git a/Sources/Tentacle/GitHubError.swift b/Sources/Tentacle/GitHubError.swift index ee62320..dcaba81 100644 --- a/Sources/Tentacle/GitHubError.swift +++ b/Sources/Tentacle/GitHubError.swift @@ -36,7 +36,7 @@ extension GitHubError: Hashable { } } -extension GitHubError: Decodable { +extension GitHubError: Argo.Decodable { public static func decode(_ j: JSON) -> Decoded { return curry(self.init) <^> j <| "message" } diff --git a/Sources/Tentacle/ResourceType.swift b/Sources/Tentacle/ResourceType.swift index 9c21b15..e23bc33 100644 --- a/Sources/Tentacle/ResourceType.swift +++ b/Sources/Tentacle/ResourceType.swift @@ -9,6 +9,6 @@ import Argo /// A Resource from the GitHub API. -public protocol ResourceType: Decodable, Hashable { +public protocol ResourceType: Argo.Decodable, Hashable { static func decode(_ json: JSON) -> Decoded } diff --git a/Sources/Tentacle/Tree.swift b/Sources/Tentacle/Tree.swift index 09762a7..162fe61 100644 --- a/Sources/Tentacle/Tree.swift +++ b/Sources/Tentacle/Tree.swift @@ -138,7 +138,7 @@ func decodeTree(_ j: JSON) -> Decoded { <^> j <| "url" } -extension Tree.Entry.EntryType: Decodable { +extension Tree.Entry.EntryType: Argo.Decodable { public static func decode(_ json: JSON) -> Decoded { guard case let .object(payload) = json else { return .failure(.typeMismatch(expected: "object", actual: "\(json)")) @@ -161,7 +161,7 @@ extension Tree.Entry.EntryType: Decodable { } } -extension Tree.Entry.Mode: Decodable {} +extension Tree.Entry.Mode: Argo.Decodable {} extension Tree.Entry.EntryType: Encodable { public func encode() -> JSON { diff --git a/Tests/TentacleTests/Fixture.swift b/Tests/TentacleTests/Fixture.swift index ffa2f3a..9aeae28 100644 --- a/Tests/TentacleTests/Fixture.swift +++ b/Tests/TentacleTests/Fixture.swift @@ -108,7 +108,7 @@ extension EndpointFixtureType { } /// Decode the fixture's JSON as an object of the returned type. - func decode() -> Object? where Object.DecodedType == Object { + func decode() -> Object? where Object.DecodedType == Object { let decoded: Decoded = Argo.decode(JSON) if case let .failure(error) = decoded { print("Failure: \(error)") @@ -118,7 +118,7 @@ extension EndpointFixtureType { } /// Decode the fixture's JSON as an array of objects of the returned type. - func decode() -> [Object]? where Object.DecodedType == Object { + func decode() -> [Object]? where Object.DecodedType == Object { let decoded: Decoded<[Object]> = Argo.decode(JSON) if case let .failure(error) = decoded { print("Failure from collection: \(error)")