Fix Fervor item schema

This commit is contained in:
Shadowfacts 2022-01-12 21:51:35 -05:00
parent be788bd0a6
commit a368bc4365
1 changed files with 4 additions and 4 deletions

View File

@ -10,8 +10,8 @@ import Foundation
public struct Item: Decodable { public struct Item: Decodable {
public let id: FervorID public let id: FervorID
public let feedID: FervorID public let feedID: FervorID
public let title: String public let title: String?
public let author: String public let author: String?
public let published: Date? public let published: Date?
public let createdAt: Date? public let createdAt: Date?
public let content: String? public let content: String?
@ -25,8 +25,8 @@ public struct Item: Decodable {
self.id = try container.decode(FervorID.self, forKey: .id) self.id = try container.decode(FervorID.self, forKey: .id)
self.feedID = try container.decode(FervorID.self, forKey: .feedID) self.feedID = try container.decode(FervorID.self, forKey: .feedID)
self.title = try container.decode(String.self, forKey: .title) self.title = try container.decodeIfPresent(String.self, forKey: .title)
self.author = try container.decode(String.self, forKey: .author) self.author = try container.decodeIfPresent(String.self, forKey: .author)
self.published = try container.decodeIfPresent(Date.self, forKey: .published) self.published = try container.decodeIfPresent(Date.self, forKey: .published)
self.createdAt = try container.decodeIfPresent(Date.self, forKey: .createdAt) self.createdAt = try container.decodeIfPresent(Date.self, forKey: .createdAt)
self.content = try container.decodeIfPresent(String.self, forKey: .content) self.content = try container.decodeIfPresent(String.self, forKey: .content)