fwcd / fwcd/swift-binary-coder

Investigate how to fix untagged enum serialization

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Swift
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Since the synthesized `Encodable` implementation for enums is externally tagged by key and we discard keys during encoding, enums currently use a completely untagged representation, which can make it hard to distinguish cases during decoding.

As described [in the test case](https://github.com/fwcd/swift-binary-coder/blob/5270e91c53e2b75a32c8383de74743233d8aab7a/Tests/BinaryCoderTests/BinaryEncoderTests.swift#L36-L39), we should investigate whether non-`.untaggedAndAmbiguous` strategies should throw an error, even though there may be a runtime cost to detect whether a type is an enum (e.g. through reflection)?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.