Skip to content

Migrate from jsonpath to jsonpath-plus - #4811

Merged
fiskus merged 8 commits into
masterfrom
migrate-jsonpath-to-jsonpath-plus
Apr 8, 2026
Merged

Migrate from jsonpath to jsonpath-plus#4811
fiskus merged 8 commits into
masterfrom
migrate-jsonpath-to-jsonpath-plus

Conversation

@fiskus

@fiskus fiskus commented Apr 8, 2026

Copy link
Copy Markdown
Member

Description

Replace jsonpath with jsonpath-plus.

  • Extract utils/jsonpath wrapper with parse function used by PackageDescription
  • Add tests for all JSONPath expressions from the Goessner spec
  • Add validation guards for empty input and missing $ root
  • One known spec deviation: jsonpath-plus does not reject malformed bracket contents (e.g. $[}}})

TODO

  • Unit tests

Greptile Summary

This PR migrates JSONPath handling from the jsonpath package to jsonpath-plus, extracting a thin utils/jsonpath wrapper that adds input guards (empty check, root $ check) before delegating to JSONPath.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 parse wrapper correctly guards empty input and missing root, toPathArray is a documented static method of jsonpath-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 parse function only calls JSONPath.toPathArray, which parses path structure without evaluating against data, so there is no eval-based code execution risk from user-supplied expressions in the validation path.

Important Files Changed

Filename Overview
catalog/app/utils/jsonpath.ts New utility wrapping jsonpath-plus with parse validation function; guards for empty input and missing $ root are correct.
catalog/app/utils/jsonpath.spec.ts Comprehensive tests covering all Goessner spec examples, invalid inputs, and the documented malformed-bracket deviation.
catalog/app/components/FileEditor/QuiltConfigEditor/BucketPreferences/PackageDescription.tsx Swapped direct jsonpath import for the new utils/jsonpath wrapper; validation call site is unchanged.
catalog/package.json Replaced jsonpath dependency with jsonpath-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]
Loading

Reviews (2): Last reviewed commit: "add changelog entry for jsonpath-plus mi..." | Re-trigger Greptile

fiskus added 4 commits April 8, 2026 15:02
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
fiskus marked this pull request as ready for review April 8, 2026 15:57
@codecov

codecov Bot commented Apr 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.65%. Comparing base (6fc2f78) to head (43152ad).
⚠️ Report is 1 commits behind head on master.

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           
Flag Coverage Δ
api-python 93.14% <ø> (ø)
catalog 19.54% <100.00%> (+0.01%) ⬆️
lambda 96.63% <ø> (ø)
py-shared 98.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fiskus

fiskus commented Apr 8, 2026

Copy link
Copy Markdown
Member Author

@greptileai review

@fiskus
fiskus enabled auto-merge April 8, 2026 16:29
@fiskus
fiskus requested a review from nl0 April 8, 2026 16:29
@fiskus fiskus changed the title Migrate from jsonpath to jsonpath-plus Migrate from jsonpath to jsonpath-plus Apr 8, 2026

@nl0 nl0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@fiskus
fiskus added this pull request to the merge queue Apr 8, 2026
Merged via the queue into master with commit a153017 Apr 8, 2026
46 checks passed
@fiskus
fiskus deleted the migrate-jsonpath-to-jsonpath-plus branch April 8, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants