fix(parse): forward type predicates to inner style#454
Merged
Conversation
JSONReadStyle wraps the user-provided style for null/dicttype/unknown_fields config, but
StructUtils dispatches on the wrapping JSONReadStyle. As a result, methods like
dictlike(::CustomJSONStyle, ::Type{A}) defined on a user JSONStyle never fired during
parsing — make() fell through to makestruct instead of makedict.
Forward dictlike, arraylike, and nulllike from JSONReadStyle to its inner st.style so
user-defined dispatches on a custom JSONStyle reach the StructUtils make() router.
Closes #453
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #454 +/- ##
==========================================
- Coverage 90.30% 90.25% -0.06%
==========================================
Files 7 7
Lines 1392 1395 +3
==========================================
+ Hits 1257 1259 +2
- Misses 135 136 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dictlike,arraylike, andnulllikefromJSONReadStyleto its innerst.styleso user-defined dispatches on a customJSONStyleare honored during parsing.Why
In v1.5.1,
JSONReadStyle{O,T,S}was changed to wrap the user-provided style to carrynull/dicttype/unknown_fieldsconfiguration through. ButStructUtils.make()dispatches on the wrappingJSONReadStyle, so a user'sdictlike(::CustomJSONStyle, ::Type{A}) = truenever fired andmakefell through tomakestructinstead ofmakedict. This broke the deserialization pattern that worked in v1.5.0, where the user's style was passed through directly.Forwarding only the type-routing predicates (
dictlike/arraylike/nulllike) was chosen deliberately:noarg/kwarg/structlike/fieldtags/fielddefaultsare set via macros at the::StructStylelevel, which already match throughJSONReadStyle.JSONStyle-level defaults are inherited by any<: JSONStyleuser style.(::JSONStyle, ::Type{<:NamedTuple})and macro-generated(::StructStyle, ::Type{<:T})methods.Closes #453
Test plan
Pkg.test())🤖 Generated with Claude Code