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-6294] Standard Library (PropertyList and JSON) Decoders Do Not Propagate {{codingPath}} Correctly #4491

Open
swift-ci opened this issue Nov 4, 2017 · 0 comments

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Nov 4, 2017

Previous ID SR-6294
Radar None
Original Reporter iosdevzone (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 2
Component/s Foundation
Labels Bug, Codable
Assignee None
Priority Medium

md5: 122fc73699f6bf537d03028c69343aa7

Issue Description:

The current Swift Standard Library implementations of JSONDecoder and PropertyListDecoder do not properly propagate `codingPath` for nested containers.

The attached playground shows the asymmetry between encoders and decoders (I created the playground to ensure that nested containers should have access to the full encoding path: encoders seem to, decoders don't – one or other should be true for both – I wanted to make sure it was not my misunderstanding.)

Using https://github.com/apple/swift/blob/master/stdlib/public/SDK/Foundation/JSONEncoder.swift

as a reference, the root cause of the problem can be found at lines: 1247, 1265, 1587, 1613; if nested containers use the decoder's codingPath and not their own to create children, well, the path will not be passed on.

Looking at the tests it seems there were not tests to examine decoder paths.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 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