Skip to content

Commit b83fe0f

Browse files
committed
fix(deps): upgrade jsonpathly to 3.0.0
As part of [0], it was noted that the upstream library we use for JSON Path expressions isn't fully RFC 9535 compliant. With help from Claude Sonnet 4.5 to help diagnose a change in the public API for jsonpathly, where a single quoted path is returned. Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io> [0]: atamano/jsonpathly#12
1 parent c48c8df commit b83fe0f

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

package-lock.json

Lines changed: 7 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"axios": "^1.7.7",
102102
"chalk": "^5.3.0",
103103
"debug": "^4.3.7",
104-
"jsonpathly": "^2.0.2",
104+
"jsonpathly": "^3.0.0",
105105
"mergician": "^2.0.2",
106106
"open": "^10.1.0"
107107
}

src/core/overlay.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ export class Overlay {
9090
// The last element (e.g. '"price"]' or '0]') contains a final ']'
9191
// so we need to remove it AND we need to parse the element to
9292
// transform the string in either a string or a number
93+
// Note: since jsonpathly v3, the returned JSON Path is wrapped in single quotes, which requires manual handling
9394
thingToActUpon =
94-
thingToActUpon === undefined ? '$' : (thingToActUpon = JSON.parse(thingToActUpon.slice(0, -1)) as number | string)
95+
thingToActUpon === undefined
96+
? '$'
97+
: (thingToActUpon = JSON.parse(thingToActUpon.slice(0, -1).replaceAll("'", '"')) as number | string)
9598

9699
// Reconstruct the stringified path expression targeting the parent
97100
const parentPath: string = explodedPath.join('][')

0 commit comments

Comments
 (0)