I am using a xml api with a possible nullable date tag. Up to version 0.9.0 it was no problem decoding the data but since 0.10.0, I am getting the following error:
valueNotFound(Foundation.Date, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "date", intValue: nil)], debugDescription: "Expected Date value but found null instead.", underlyingError: nil))
I reproduced the behavior with the following struct ...
import Foundation
struct DateTest : Codable {
let name: String
let date: Date?
let nullableString: String?
}
... and test.
func testNullableDateParsing() throws {
let decoder = XMLDecoder()
let xml = """
<container>
<name>Null date</name>
<date></date>
<nullableString></nullableString>
</container>
"""
let data = xml.data(using: .utf8)!
XCTAssertNoThrow(try decoder.decode(DateTest.self, from: data))
}
P.S.: Is it normal that when a decoding error occurs inside a sub struct, that the original error is hidden?
I am using a xml api with a possible nullable date tag. Up to version 0.9.0 it was no problem decoding the data but since 0.10.0, I am getting the following error:
I reproduced the behavior with the following struct ...
... and test.
P.S.: Is it normal that when a decoding error occurs inside a sub struct, that the original error is hidden?