[SR-10078] Decode fail with an optional enum property #52480
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Codable
Area → standard library: `Codable` and co.
standard library
Area: Standard library umbrella
Attachment: Download
Additional Detail from JIRA
md5: 9892ca2b5bd246ad11addcb4eddc868e
Issue Description:
Swift Codable is an awesome feature that i'm using very regularly. But while working with it I found an issue.
So I have a basic struct like this:
And i tried to parse `Parent` with an undefined value from `Children`, i.e:
The issue is instead of receving a Parent instance with
childrean = nil
, it through me a serialization error:Please refer to the playground file i attached below. Note that it will work if i define my own decode init function. (can just uncomment
public init(from decoder: Decoder) throws
The text was updated successfully, but these errors were encountered: