Roundtrip foreign members
1ec5 opened this issue · 1 comments
1ec5 commented
A GeoJSONObject should roundtrip from and to JSON in its entirety, including any foreign members (JSON properties outside of the properties
object).
When decoding from JSON, any property in KeyedDecodingContainer.allKeys
but not CodingKeys
should be stored in a userInfo
property of type JSONObject
, which would get encoded back to JSON as the original properties. If the userInfo
dictionary has a key that’s reserved in CodingKeys
, such as property
or id
, the Encodable implementation could ignore it.
1ec5 commented
Per mapbox/mapbox-directions-swift#637 (comment), the CodingKey implementation would be an extensible enumeration so that allKeys
can return everything, not just what we’ve statically defined for the type.