feat: Add Jmespath expression function in frontend - #19028
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR adds JMESPath expression function support to the expression evaluator system. It introduces a base evaluator class for standardised error handling, implements a JMESPath-specific evaluator, defines the schema contract, integrates the new function into the expression registry, refactors an existing evaluator to use the new base class, and includes comprehensive test fixtures. ChangesJMESPath Expression Function Implementation
Sequence DiagramsequenceDiagram
participant ExprFunction as Expression Function
participant Evaluator as JmespathFunctionEvaluator
participant JMESPath as jmespath.search()
participant Validation as assertValidValue
ExprFunction->>Evaluator: new(context, [data, query])
Evaluator->>JMESPath: search(data, query)
JMESPath-->>Evaluator: result
Evaluator->>Validation: assertValidValue(result)
Validation-->>Evaluator: validated
Evaluator-->>ExprFunction: return ValidValue
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…essions # Conflicts: # src/App/frontend/monorepo-changed-paths.txt
…ns/component/lookup-list.json
Co-authored-by: Ole Martin Handeland <github@olemartin.org>
…into add-jmespath-function # Conflicts: # src/App/frontend/src/features/expressions/function-evaluators/ObjectFunctionEvaluator.ts
Important
This pull request is stacked upon #18982, which should be merged first.
Description
This pull request adds support for Jmespath queries in our expression language. This includes a new dependnecy; Jmespath JS.
This also includes a new function evaluator class;
JmespathFunctionEvaluator. Since it follows the same pattern asObjectFunctionEvaluator, I have also added an abstract class that both of them extend and moved them into a separate folder. In the future, we may consider refactoring more of the functions the same way in order to makeexpression-functions.tseasier to navigate.Here is the corresponding implementation in backend: Altinn/app-lib-dotnet#1790
Verification
Summary by CodeRabbit