From 060e0e389814a82ba45fb2ef1bb0f591a2cbb828 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sat, 12 Jan 2019 21:51:51 -0800 Subject: [PATCH] Move PolyWrapped out of Poly and into JSONAPI. --- Package.resolved | 2 +- Sources/JSONAPI/Resource/Poly+PrimaryResource.swift | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index 81285d1..d5dcf55 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,7 +6,7 @@ "repositoryURL": "https://github.com/mattpolzin/Poly.git", "state": { "branch": "master", - "revision": "92d889c2cdc027bb94814187e84d34783ae159ae", + "revision": "b2a2198ada7d826903411678e19a6d953f52dcbd", "version": null } } diff --git a/Sources/JSONAPI/Resource/Poly+PrimaryResource.swift b/Sources/JSONAPI/Resource/Poly+PrimaryResource.swift index 2e39a78..66aaf63 100644 --- a/Sources/JSONAPI/Resource/Poly+PrimaryResource.swift +++ b/Sources/JSONAPI/Resource/Poly+PrimaryResource.swift @@ -17,6 +17,8 @@ import Poly /// encoding or decoding. public typealias JSONPoly = Poly & PrimaryResource +public typealias PolyWrapped = Codable & Equatable + extension Poly0: PrimaryResource { public init(from decoder: Decoder) throws { throw JSONAPIEncodingError.illegalDecoding("Attempted to decode Poly0, which should represent a thing that is not expected to be found in a document.") @@ -28,7 +30,7 @@ extension Poly0: PrimaryResource { } // MARK: - 1 type -extension Poly1: PrimaryResource, MaybePrimaryResource where A: Codable & Equatable {} +extension Poly1: PrimaryResource, MaybePrimaryResource where A: PolyWrapped {} // MARK: - 2 types extension Poly2: PrimaryResource, MaybePrimaryResource where A: PolyWrapped, B: PolyWrapped {}