当 Class 中包含闭包属性时,mapper 中标记忽略 Exclud 该属性,在序列化 toJson() 中无效
- Dominant language
- Swift
- Stars
- 4.3k
- Forks
- 677
- PR merge metrics
- No merged PRs in 30d
Description
示例代码:
```
class AAA: HandyJSON {
var a = "a"
var b = 1
var c = false
var p1: (() -> Void)?
required init() {}
func mapping(mapper: HelpingMapper) {
mapper >>> self.p1
}
}
```
使用示例:
```
let a = AAA()
a.p1 = {
let a = 1+1
}
let json = a.toJSONString()
```
此时在 `_ExtendCustomModelType.swift` 文件中 line:243 。`if mapper.propertyExcluded(key: Int(bitPattern: info.address)) ` 判断条件为 false。原因是 address 对应不上
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the reproduction in the issue and inspect _ExtendCustomModelType.swift around line 243, where propertyExcluded is checked during toJSONString serialization. Compare the mapper key with the closure property's address and determine why they differ. Done means the excluded closure property is omitted from the serialized JSON for the provided AAA example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100