CodableWrappers
CodableWrappers copied to clipboard
Implement CurrentPathCoding
Hey! It is not final version of intended PR, but I wanted to make sure that author is interested in such feature. Implemented @CurrentPathCoding wrapper allows this JSON structure:
{
"title": "Cool title",
"authorName": "John",
"authorEmail": "[email protected]"
}
to be mapped to such model:
struct Author: Codable {
var authorName: String
var authorEmail: String
}
struct Article: Codable {
var title: String
@CurrentPathCoding
var author: Author
}
If you can approve that such wrapper has the right to life and you would merge it, I'll add documentation and tests and then finalise the PR.
Also you are welcome to provide better naming 😊
If it works something like this would be great! glancing at it I'm a bit concerned about how nesting works, but I should have some time to look at it more closely this weekend.