CodableWrappers icon indicating copy to clipboard operation
CodableWrappers copied to clipboard

Implement CurrentPathCoding

Open ky1vstar opened this issue 4 years ago • 3 comments

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.

ky1vstar avatar Apr 30 '21 17:04 ky1vstar

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Apr 30 '21 17:04 sonarqubecloud[bot]

Also you are welcome to provide better naming 😊

ky1vstar avatar Apr 30 '21 18:04 ky1vstar

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.

GottaGetSwifty avatar Apr 30 '21 19:04 GottaGetSwifty