|
|
| Previous ID |
SR-4861 |
| Radar |
None |
| Original Reporter |
@norio-nomura |
| Type |
Bug |
| Status |
Resolved |
| Resolution |
Done |
Environment
swift-DEVELOPMENT-SNAPSHOT-2017-05-10-a
Additional Detail from JIRA
|
|
| Votes |
0 |
| Component/s |
Foundation |
| Labels |
Bug |
| Assignee |
@itaiferber |
| Priority |
Medium |
md5: be28d8313133a12035d523766af2199e
Issue Description:
I'm implementing `YAMLEncoder` on jpsim/Yams#43
YAML has representations of Data and Date.
Date: http://yaml.org/type/timestamp.html
Data: http://yaml.org/type/binary.html
So, `YAMLEncoder` checks type in `encode<T>(_:)` and `decode<T>(_:)` whether it is `Data` or `Date`:
https://github.com/jpsim/Yams/pull/43/files#diff-7f4ff11f6b9e9c9f0412bd59e10f918bR229
to representing them in `YAML` spec.
YAML allows simple value as root document.
e.g. YAML document with single date value:
But, `SingleValueEncodingContainer` and `SingleValueDecodingContainer` do not have generic `encode` and `decode`, so `Data` and Date` are encoded/decoded by each own's `Codable` implementations:
e.g.Single `Date` value is encoded as `Double`:
To getting expected result from encode, I need `encode<T>(_:)` and `decode<T>(_:)` to `SingleValueEncodingContainer` and `SingleValueDecodingContainer` to allowing `YAMLEncoder` checking types as same as another containers.