Fix Review.reviewer_itemname never decoding#26
Merged
Conversation
The decoder uses keyDecodingStrategy = .convertFromSnakeCase, which transforms the JSON key reviewer_itemname to reviewerItemname before CodingKeys matching. The synthesized key for the snake_case Swift property never matched, so the field silently decoded to nil under both ZippyJSONDecoder and Foundation's JSONDecoder. Rename the property and public init label to reviewerItemname, matching the camelCase convention used by every other model field (filesCount, itemSize, workableServers). Add regression tests that decode a review fixture mirroring metadataResponse.json under both decoders. Closes #25 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Keep the old snake_case spelling working so the rename is additive rather than source-breaking: a deprecated computed alias forwards to reviewerItemname, and a deprecated init overload preserves the old reviewer_itemname: parameter label. The overload's reviewer_itemname parameter has no default so Review() stays unambiguous. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ac33 * origin/main: Replace dead Travis CI with GitHub Actions (#24)
The merged .swiftlint.yml excludes reviewer_itemname from identifier_name globally, so the inline swiftlint:disable:next directives no longer silence anything and would be flagged as superfluous_disable_command. Remove them and clarify the config comment to note reviewer_itemname is now a deprecated alias. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
+ Coverage 88.35% 90.03% +1.68%
==========================================
Files 13 13
Lines 541 552 +11
==========================================
+ Hits 478 497 +19
+ Misses 63 55 -8 ☔ View full report in Codecov by Harness. 🚀 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
Review.reviewer_itemnamealways decoded tonil: the decoder'skeyDecodingStrategy = .convertFromSnakeCaseconverts the JSON keyreviewer_itemnametoreviewerItemnamebefore CodingKeys matching, so the synthesized key for the snake_case Swift property never matchedreviewerItemname, matching the camelCase convention every other model already uses (filesCount,itemSize,workableServers)reviewer_itemnameforwards toreviewerItemname(withrenamed:fix-it)reviewer_itemname:parameter label; its parameter has no default soReview()stays unambiguousReviewTests.swiftwith regression tests decoding a fixture mirroringMockResponse/metadataResponse.jsonunder bothZippyJSONDecoderand Foundation'sJSONDecoder(ZippyJSON falls back to Foundation on unsupported platforms, so both must agree), plus coverage for the deprecated spellings and init-overload resolutionChose the rename over explicit
CodingKeys: aCodingKeysfix would need the confusing post-conversion mappingcase reviewer_itemname = "reviewerItemname", and no model in the package usesCodingKeystoday.Closes #25
Test plan
ReviewTestsfailed before the fix (nilunder both decoders), pass afterreviewer_itemnameproperty andinit(reviewer_itemname:)overload covered bytestDeprecatedSnakeCaseSpellingsStillWorkswift test— 70 tests, 0 failures🤖 Generated with Claude Code