alibaba / alibaba/HandyJSON

让用户可以自行对某些字段进行完全的自定义操作

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

Description

class Student: HandyJSON {
var id: String?
var name: String?
var age: Int?
var grade: Grade = .One
var height: Int?
var gender: Gender?
var className: String?
var teacher: Teacher = Teacher()
var subjects: [Subject]?
var seat: String?

required init() {}
// 父类不实现此方法,子类也不会调用
// func mapping(mapper: HelpingMapper) {
//// mapper <<<
//// self.descriptionValue <-- "description"
// // mapper.specify(property: &Ï, name: "description")
// }
}

class MissionDetailModel: Student {
var attachments: [String]?
var deadLine: String?
var descriptionValue: String?
var hunter: String?
var walletId: String?
var actionTypes: [String]?

required init() {
super.init()
}

override func mapping(mapper: HelpingMapper) {
super.mapping(mapper: mapper)
mapper <<<
self.descriptionValue <-- "description"
// mapper.specify(property: &Ï, name: "description")
}

}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Student and MissionDetailModel examples in the issue and inspect the HelpingMapper mapping API and inheritance behavior. Reproduce whether MissionDetailModel.mapping can customize descriptionValue while retaining inherited mappings; done means a supported, test-covered way for a field to use fully custom mapping behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.