atlassian / atlassian/better-ajv-errors

Errors with different path got overwritten

Open
#81 3 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
245
Forks
50
PR merge metrics
No merged PRs in 30d

Description

When there are errors of more than one different paths in ajv error list, the `helpers.makeTree` function will overwrite the previous errors in the path with the new one in the reduce function:
```javascript
paths &&
paths.reduce((obj, path, i) => {
obj.children[path] = obj.children[path] || { children: {}, errors: [] };
if (i === paths.length - 1) {
obj.children[path].errors.push(ajvError);
}
return obj.children[path];
}, root);
```
Is this an intended design?

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the helpers.makeTree function and trace the reduce callback shown in the issue, then reproduce the behavior with AJV errors from different paths. Confirm with the maintainer whether errors from each path should be retained; the work is done when that behavior is decided and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.