From 9e8c288a25580da0d3802fa8b2c6cc5c0692fc39 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Tue, 23 Aug 2022 23:35:16 -0700 Subject: [PATCH] still trying to fix primary resource decoding error --- Sources/JSONAPI/Document/DocumentDecodingError.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/JSONAPI/Document/DocumentDecodingError.swift b/Sources/JSONAPI/Document/DocumentDecodingError.swift index f9994cf..34ff222 100644 --- a/Sources/JSONAPI/Document/DocumentDecodingError.swift +++ b/Sources/JSONAPI/Document/DocumentDecodingError.swift @@ -33,10 +33,10 @@ public enum DocumentDecodingError: Swift.Error, Equatable { self = .primaryResourceMissing case .valueNotFound(let type, let context) where Location(context) == .data && type == UnkeyedDecodingContainer.self: self = .primaryResourcesMissing - case .typeMismatch(let type, let context) where Location(context) == .data && type is AbstractResourceObject.Type && context.debugDescription.hasSuffix("but found null instead."): - self = .primaryResourceMissing case .typeMismatch(let type, let context) where Location(context) == .data && type == UnkeyedDecodingContainer.self && context.debugDescription.hasSuffix("but found null instead."): self = .primaryResourcesMissing + case .typeMismatch(_, let context) where Location(context) == .data && context.debugDescription.hasSuffix("but found null instead."): + self = .primaryResourceMissing default: return nil }