mirror of
https://github.com/encounter/JSONAPI.git
synced 2026-03-30 11:18:38 -07:00
Apply EmptyObjectDecoder rather than empty JSON
Co-Authored-By: Mathew Polzin <matt.polzin@gmail.com>
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
// Created by Mathew Polzin on 7/24/18.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// A JSON API structure within an ResourceObject that contains
|
||||
/// named properties of types `ToOneRelationship` and
|
||||
@@ -600,7 +599,7 @@ public extension ResourceObject {
|
||||
|
||||
relationships = try (NoRelationships() as? Description.Relationships)
|
||||
?? container.decodeIfPresent(Description.Relationships.self, forKey: .relationships)
|
||||
?? JSONDecoder().decode(Description.Relationships.self, from: "{}".data(using: .utf8)!)
|
||||
?? Description.Relationships(from: EmptyObjectDecoder())
|
||||
|
||||
meta = try (NoMetadata() as? MetaType) ?? container.decode(MetaType.self, forKey: .meta)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user