Open
Description
Previous ID | SR-10630 |
Radar | None |
Original Reporter | stjernegard (JIRA User) |
Type | Bug |
Attachment: Download
Environment
Xcode 10.2.1 (10E1001)
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.5.0
Additional Detail from JIRA
Votes | 0 |
Component/s | Foundation |
Labels | Bug, Codable |
Assignee | bendjones (JIRA) |
Priority | Medium |
md5: 5efcc4caa9e3495f987fbfb0a346bfdf
relates to:
- SR-7360 keyDecodingStrategy breaks dictionary-keys
Issue Description:
JSONDecoder has regressed between Swift 4.2.4 and Swift 5.0.
Encoding the value ["camelCase": 1]
with .convertToSnakeCase
would convert the key in Swift 4, but no longer does so in Swift 5.
I can't find anything in the release notes suggesting that this is an expected outcome.
A Swift file showing the issue is attached.
➤ ./swift-4.2.4-RELEASE.xctoolchain/usr/bin/swift ~/test.swift
{"camel_case":1}
➤ ./swift-5.0-RELEASE.xctoolchain/usr/bin/swift ~/test.swift
{"camelCase":1}