Move PolyWrapped out of Poly and into JSONAPI.

This commit is contained in:
Mathew Polzin
2019-01-12 21:51:51 -08:00
parent b374367234
commit 060e0e3898
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
"repositoryURL": "https://github.com/mattpolzin/Poly.git",
"state": {
"branch": "master",
"revision": "92d889c2cdc027bb94814187e84d34783ae159ae",
"revision": "b2a2198ada7d826903411678e19a6d953f52dcbd",
"version": null
}
}
@@ -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 {}