Skip to content

Commit 26bfaec

Browse files
committed
task: minor fix for collection utils
1 parent 1b297b7 commit 26bfaec

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tools/spectral/ipa/rulesets/functions/utils/collectionUtils.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { EXCEPTION_EXTENSION } from './exceptions.js';
44
/**
55
* Collects a violation entry and returns formatted error data.
66
*
7-
* @param {Array<string>} path - The JSON path for the object where the rule violation occurred.
7+
* @param {Array<string>} jsonPath - The JSON path for the object where the rule violation occurred. Example: 'paths./pets.get])
88
* @param {string} ruleName - The name of the rule that was violated.
99
* @param {string|Array<Object>} errorData - The error information. Can be either a string message or an array of error objects.
1010
* @returns {Array<Object>} An array of error objects. Each object has a 'message' property.
1111
* @throws {Error} Throws an error if errorData is neither a string nor an array.
1212
*
1313
*/
14-
export function collectAndReturnViolation(path, ruleName, errorData) {
15-
collector.add(EntryType.VIOLATION, path, ruleName);
14+
export function collectAndReturnViolation(jsonPath, ruleName, errorData) {
15+
collector.add(EntryType.VIOLATION, jsonPath, ruleName);
1616

1717
if (typeof errorData === 'string') {
1818
return [{ message: errorData }];
@@ -29,8 +29,8 @@ export function collectAndReturnViolation(path, ruleName, errorData) {
2929
* @param {Array<string>} path - The JSON path for the object where the rule adoption occurred.
3030
* @param {string} ruleName - The name of the rule that was adopted.
3131
*/
32-
export function collectAdoption(path, ruleName) {
33-
collector.add(EntryType.ADOPTION, path, ruleName);
32+
export function collectAdoption(jsonPath, ruleName) {
33+
collector.add(EntryType.ADOPTION, jsonPath, ruleName);
3434
}
3535

3636
/**
@@ -40,9 +40,9 @@ export function collectAdoption(path, ruleName) {
4040
* @param {Array<string>} path - The JSON path for the object where the rule exception occurred.
4141
* @param {string} ruleName - The name of the rule that the exception is defined for.
4242
*/
43-
export function collectException(object, ruleName, path) {
43+
export function collectException(object, ruleName, jsonPath) {
4444
let exceptionReason = object[EXCEPTION_EXTENSION][ruleName];
4545
if (exceptionReason) {
46-
collector.add(EntryType.EXCEPTION, path, ruleName, exceptionReason);
46+
collector.add(EntryType.EXCEPTION, jsonPath, ruleName, exceptionReason);
4747
}
4848
}

0 commit comments

Comments
 (0)