alibaba / alibaba/HandyJSON

Dynamic var mapping

Open
#222 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4.3k
Forks
677
PR merge metrics
No merged PRs in 30d

Description

class GitHubRepo: HandyJSON {

@objc dynamic var repoName: String = ""

required init() {

}

func mapping(mapper: HelpingMapper) {
mapper <<<
self.repoName <-- "name"
}
}

想要将 dynamic 的属性映射为其他字段好像不行啊,这种情况解析出来的 model.repoName 还是没赋值的

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue provides a GitHubRepo example with a dynamic repoName property mapped from “name”, but names no repository file or test. Reproduce deserialization with that example, then trace HandyJSON’s Swift mapping path for dynamic properties and add a regression test confirming that model.repoName receives the JSON value.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.