Migrate from jsonpath to jsonpath-plus - #4811
Merged
Merged
Conversation
Prepare for jsonpath -> jsonpath-plus migration: - Add utils/jsonpath wrapper with parse function - Add tests for all Goessner article JSONPath expressions - Point PackageDescription to the wrapper
Replace jsonpath (unmaintained) with jsonpath-plus. Add validation guards to enforce Goessner spec constraints that jsonpath-plus does not check (empty input, missing $ root). One known deviation: malformed bracket contents are not rejected.
Remove jsonpath and @types/jsonpath, add jsonpath-plus.
fiskus
marked this pull request as ready for review
April 8, 2026 15:57
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4811 +/- ##
=======================================
Coverage 45.65% 45.65%
=======================================
Files 829 830 +1
Lines 33564 33569 +5
Branches 5721 5723 +2
=======================================
+ Hits 15322 15327 +5
Misses 16241 16241
Partials 2001 2001
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
@greptileai review |
fiskus
enabled auto-merge
April 8, 2026 16:29
jsonpath to jsonpath-plus
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.
Description
Replace
jsonpathwithjsonpath-plus.utils/jsonpathwrapper withparsefunction used byPackageDescription$rootjsonpath-plusdoes not reject malformed bracket contents (e.g.$[}}})TODO
Greptile Summary
This PR migrates JSONPath handling from the
jsonpathpackage tojsonpath-plus, extracting a thinutils/jsonpathwrapper that adds input guards (empty check, root$check) before delegating toJSONPath.toPathArray. The migration is clean, with a comprehensive test suite covering the Goessner spec examples and the one documented deviation (malformed bracket contents).Confidence Score: 5/5
Safe to merge — clean library migration with no logic regressions and a thorough test suite.
All changed files look correct: the new
parsewrapper correctly guards empty input and missing root,toPathArrayis a documented static method ofjsonpath-plus, and the one known spec deviation is explicitly tested and documented. No P0/P1 issues found.No files require special attention.
Vulnerabilities
No security concerns identified. The
parsefunction only callsJSONPath.toPathArray, which parses path structure without evaluating against data, so there is noeval-based code execution risk from user-supplied expressions in the validation path.Important Files Changed
jsonpath-pluswithparsevalidation function; guards for empty input and missing$root are correct.utils/jsonpathwrapper; validation call site is unchanged.jsonpathdependency withjsonpath-plus@^10.4.0.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[User enters JSONPath label] --> B[JsonPaths handleChange or handleBlur] B --> C[jsonpath.parse called per label] C --> D{expr is falsy?} D -- yes --> E[throw SyntaxError] D -- no --> F["JSONPath.toPathArray(expr) from jsonpath-plus"] F --> G{"parts[0] === '$'?"} G -- no --> E G -- yes --> H[return parts - validation passes] H --> I[setError null, config saved] E --> J[catch in handleChange - setError with message]Reviews (2): Last reviewed commit: "add changelog entry for jsonpath-plus mi..." | Re-trigger Greptile