- 
                Notifications
    
You must be signed in to change notification settings  - Fork 63
 
Description
Hi,
I love using Marshal for mapping as it's far more simple and straightforward than other options.
I think that the only pain is that if mapping fails for some reason, it is very complicated to determine where the problem occurred (especially if you have complicated JSON structure with repeating keys). I thought that this could be solved by making MarshalError a bit more descriptive. This would mean that MarshalError would become a struct.
Let's say it would look like this (maybe adding a property to add the payload which failed to map would be also useful).
public struct MarshalError {
    public enum Kind { ... current MarshalError cases }
    public let kind: Kind
    public let objectTypes: [Any.Type]
}
This structure would allow any ValueType to add which type didn't managed to map itself. I've been playing with this idea in playground so this would be the first idea of implementation, but I'm sure it would be possible to wrap it into some function which would make the use of it easier.
I'm open to implementing this change but I'd love to discuss it first - it's a big breaking change and I don't want to make it without any chance to get this merged 🙂.