Fix interpretation of integer segment on objects - #519
Open
satabin wants to merge 1 commit into
Open
Conversation
satabin
force-pushed
the
pointer/int-field
branch
from
September 3, 2026 07:35
397d6f9 to
fd3e753
Compare
When the pointer segment is an integer and it is evaluated on an object, look for the field name being that integer instead of failing. Fixes #517
satabin
force-pushed
the
pointer/int-field
branch
from
September 3, 2026 07:40
fd3e753 to
bc5f85e
Compare
yhefamly
approved these changes
Sep 8, 2026
| case (JsObject(obj), Inner(Left(elem), tl), parent) => | ||
| F.pure(Left((obj.getOrElse(elem, Json.Null), tl, parent / elem))) | ||
| case (JsObject(obj), Inner(elem, tl), parent) => | ||
| val fieldName = elem.fold(identity, _.toString()) |
There was a problem hiding this comment.
Suggestion (optional): Use Integer.toString to make it more clear what we're converting, took me a moment (without IDE admittedly) to figure out we're not calling toString() on some arbitrary types here.
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.
When the pointer segment is an integer and it is evaluated on an object, look for the field name being that integer instead of failing.
Fixes #517
Note: in this PR I also fixed some warnings. The diffson codebase shows its age sometimes and I never took the time to properly fix the imports and new conventions globally, at least I started doing it for this part of the code.