-
Notifications
You must be signed in to change notification settings - Fork 13
#4941 - Approved exception does not repeat - New JSON Lib #5010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#4941 - Approved exception does not repeat - New JSON Lib #5010
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the JSONPath library with the JSONata library to enable more advanced filtering and transformations needed for the new exceptions structure. This change allows for more powerful data manipulation capabilities in workflow expressions.
Key changes:
- Replace JSONPath with JSONata library in package dependencies
- Update all workflow BPMN files to use JSONata syntax instead of JSONPath expressions
- Refactor utility functions to use JSONata's asynchronous evaluation API
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sources/packages/backend/package.json | Updates dependency from jsonpath to jsonata library |
| sources/packages/backend/apps/workers/src/utilities/jsonpath/jsonpath-utils.ts | Removes old JSONPath utility functions |
| sources/packages/backend/apps/workers/src/utilities/json/json-utils.ts | Adds new JSONata utility functions with async support |
| sources/packages/backend/apps/workers/src/utilities/index.ts | Updates export to use new json-utils instead of jsonpath-utils |
| sources/packages/backend/apps/workers/src/controllers/supporting-user/supporting-user.controller.ts | Updates to use JSONata syntax and async evaluation |
| sources/packages/backend/apps/workers/src/controllers/assessment/assessment.controller.ts | Updates to use async filterObjectProperties |
| sources/packages/backend/workflow/src/workflow-definitions/supporting-user-information-request.bpmn | Updates JSONPath expressions to JSONata syntax |
| sources/packages/backend/workflow/src/workflow-definitions/load-assessment-consolidated-data.bpmn | Updates all JSONPath expressions to JSONata syntax |
| sources/packages/backend/workflow/src/workflow-definitions/assessment-gateway-v2.bpmn | Updates JSONPath expression to JSONata syntax |
| sims.code-workspace | Adds jsonata to spell check dictionary and reorganizes entries |
Files not reviewed (1)
- sources/packages/backend/package-lock.json: Language not supported
| * where the values for each property are the values | ||
| * resulting from the jsonata expressions execution. | ||
| */ | ||
| export async function filterObjectProperties( |
Copilot
AI
Jul 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function processes filters sequentially in a for-of loop. Consider using Promise.all() to evaluate all JSONata expressions in parallel for better performance when dealing with multiple filters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expressions are expected to be evaluated synchronously.
| currentProgramYear = await db.programYear | ||
| .createQueryBuilder("py") | ||
| .where("NOW() BETWEEN py.startDate AND py.endDate") | ||
| .where("CURRENT_DATE BETWEEN py.startDate AND py.endDate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails on the last day of a program year because it uses a date+time when executing the comparison between two date-only columns.
It would pass tomorrow 😄
|
.../packages/backend/apps/workers/src/controllers/supporting-user/supporting-user.controller.ts
Show resolved
Hide resolved
sh16011993
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @andrewsignori-aot 👍 Thanks for clarifying my questions.
| @@ -1,5 +1,5 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.35.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.6.0" camunda:diagramRelationId="f874f098-96b6-491d-81ec-ecf7a0d8c67a"> | |||
| <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.37.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.6.0" camunda:diagramRelationId="f874f098-96b6-491d-81ec-ecf7a0d8c67a"> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| hasNOAApproval, | ||
| ); | ||
| const outputVariables = filterObjectProperties( | ||
| const outputVariables = await filterObjectProperties( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "$" at the beginning is compatible with the new framework. I can remove from this to avoid confusion in the future.
dheepak-aot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work finding the better way to parse json data and thanks for the sync up. One minor observation on E2E tests.




Important note about the expressions
Assuming the below JSON (array with a single item).
{ "courseDetails": [ { "courseCode": "code", "courseName": "name" } ] }Using the expression below
will produce the result as an object, not an array.
{ "courseCode": "code" }To produce an array even when there is only one item, the expression should be as below.
to produce
[ { "courseCode": "code" } ]Manual tests