Are you prepared to support field mapping?

#62 · closed · 0 comments

View on GitHub ↗

rakuyoMo

`BetterCodable` is very cool library, but I noticed that field mapping doesn't seem to be supported now? I have to keep the model fields and json fields unified, which may not be a good fit for our project. Do you have any plans to support field mapping? This would help us to completely ditch the custom `Codable` implementation. Using `DefaultCodable` as an example, you can add an optional String type parameter to the `init(wrappedValue:)` method. Afterwards, the `init(from:)` and `encode(to:)` methods decide whether to use the `singleValueContainer` or `container(keyedBy:)` method depending on whether the field has a value or not.

Comments