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

[SR-11145] Also synthesise default CodingKeys when only conforming to Encodable OR Decodable #53541

Open
swift-ci opened this issue Jul 16, 2019 · 1 comment

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Jul 16, 2019

Previous ID SR-11145
Radar None
Original Reporter MrLotU (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, Codable
Assignee bendjones (JIRA)
Priority Medium

md5: ea038e2f6a5b30bf37c1cd332016a054

Issue Description:

Right now when conforming a type to Codable the compiler auto syntesizes the CodingKeys. However, if you conform to either Encodable or Decodable, this does not happen.

I think it'd be a great addition to have the auto synthesised CodingKeys also when not conforming to both Encodable and Decodable.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Jul 16, 2019

Comment by Owen Voorhees (JIRA)

SE-0166 says:
Types conforming to Encodable whose properties are all Encodable get an automatically generated String-backed CodingKey enum mapping properties to case names. Similarly for Decodable types whose properties are all Decodable

So this could maybe considered a bug fix which doesn't require an evolution proposal?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant