Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roundtrip foreign members #174

Closed
1ec5 opened this issue Dec 14, 2021 · 1 comment · Fixed by #175
Closed

Roundtrip foreign members #174

1ec5 opened this issue Dec 14, 2021 · 1 comment · Fixed by #175
Assignees
Labels
feature New feature request. JS parity

Comments

@1ec5
Copy link
Contributor

1ec5 commented Dec 14, 2021

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
Copy link
Contributor Author

1ec5 commented Dec 14, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request. JS parity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant