willStartMapping feature
- Dominant language
- Swift
- Stars
- 4.3k
- Forks
- 677
- PR merge metrics
- No merged PRs in 30d
Description
考虑以下场景:
```swift
class A {
var type: Type //some enum
var subType: SubType
func mapping(mapper: HelpingMapper) {
mapper <<< subType <-- (["subType1", "subType2"] , TransformOf(
//这里 subType1 和 subType2 的 json 值有重叠,但根据 type 不同,相同的 json 值可能表示不同的 enum 值
}
}
```
所以希望提供一个`willStartMapping`方法,于`mapping` 方法之前,给`type`赋值
----
consider following situation:
```swift
class A {
var type: Type //some enum
var subType: SubType
func mapping(mapper: HelpingMapper) {
mapper <<< subType <-- (["subType1", "subType2"] , TransformOf(
// here subType1 and subType2 has duplicated json values with different enum values, which depends on `type`
}
}
```
so I need a `willStartMapping` feature to fill the `type` before `mapping` function is called
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing where mapping(mapper:) is invoked during deserialization and how the TransformOf enum values are resolved; the issue names no files or tests. Define completion as a willStartMapping hook that populates type before mapping runs, allowing duplicated JSON values to resolve according to type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100