+
Skip to content

Conversation

nekrich
Copy link
Contributor

@nekrich nekrich commented Aug 12, 2025

Feature: Support for DecodableWithConfiguration

Summary

This PR introduces support for decoding types conforming to the new DecodableWithConfiguration protocol.

This enables more flexible and context-aware decoding by allowing strongly typed configuration to be passed during decoding — unlike userInfo.

What's Changed

  • Added support for decoding DecodableWithConfiguration objects.
  • Refactored existing decoding paths to maintain a single _Decoder construction and Node parsing logic across calls to decode Decodable and DecodableWithConfiguration.
  • New public API is the same as in the JSONDecoder.

Why

Some types require external context (e.g., formatting rules, environment settings, or feature flags) when being decoded. DecodableWithConfiguration enables passing that context directly into the decoding process without affecting other parts of the codebase.

Tests

Provided for both cases:

  • Decoding with direct DecodingConfiguration instance.
  • Decoding with DecodingConfigurationProvider constructor.

Breaking changes

None. This change is purely additive and introduces no breaking changes to the existing API.

@lynchsft
Copy link
Collaborator

lynchsft commented Sep 6, 2025

Thank you for this valuable contribution. If we can address the build errors on non-apple platforms, I’d love to merge it. I’ll give a detailed read to the changes after the builds are green. :)

@nekrich nekrich force-pushed the feat/DecodableWithConfiguration branch from 4395324 to 2399bda Compare September 11, 2025 09:49
@nekrich
Copy link
Contributor Author

nekrich commented Sep 11, 2025

Tried to fix the failing Action.
The reason is a bug (or a new feature) on GH Runners: actions/runner-images#12912

Suggested fix: actions/runner-images#12912 (comment)

But GHA team says that the new image rollout with the fix is soon: actions/runner-images#12912 (comment)

And I'm not sure if ninja is affected too 🤷

@lynchsft
Copy link
Collaborator

Thanks for trying to fix the GH runner issue. Let's let GHA team handle that. Preferably, you'd address the swift compilation error in the tests. FileManager does not conform to Equatable on non-apple platforms. :)

Thank you again for this needed enhancement. 🙏🏻

@nekrich
Copy link
Contributor Author

nekrich commented Sep 14, 2025

Thanks for approving workflows. Switched to NonDecodableObject instead of FileManager.

@lynchsft
Copy link
Collaborator

lynchsft commented Oct 3, 2025

@nekrich, please forgive me for the long silence. I've had a very busy season. @jpsim has kindly address the windows failures on older versions of Swift with some administrative wisdom. I believe if you merge/rebase your changes from/with the main branch we can git this improvement merged and released!

@lynchsft
Copy link
Collaborator

lynchsft commented Oct 3, 2025

I'll address the macOS 15 with Xcode 16.0 failure today.

@lynchsft
Copy link
Collaborator

lynchsft commented Oct 5, 2025

Only one lint issue left to tic then we'll merge and release. 😀

Break up long line for SwiftLint rule.
Remove trailing whitespace for SwiftLint.
@lynchsft lynchsft merged commit 8c98125 into jpsim:main Oct 7, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载