diff --git a/tools/spectral/ipa/rulesets/functions/utils/collectionUtils.js b/tools/spectral/ipa/rulesets/functions/utils/collectionUtils.js index 653c632fc6..ab8c931bee 100644 --- a/tools/spectral/ipa/rulesets/functions/utils/collectionUtils.js +++ b/tools/spectral/ipa/rulesets/functions/utils/collectionUtils.js @@ -4,15 +4,15 @@ import { EXCEPTION_EXTENSION } from './exceptions.js'; /** * Collects a violation entry and returns formatted error data. * - * @param {Array} path - The JSON path for the object where the rule violation occurred. + * @param {Array} jsonPath - The JSON path array for the object where the rule violation occurred. Example: ["paths","./pets","get"] * @param {string} ruleName - The name of the rule that was violated. * @param {string|Array} errorData - The error information. Can be either a string message or an array of error objects. * @returns {Array} An array of error objects. Each object has a 'message' property. * @throws {Error} Throws an error if errorData is neither a string nor an array. * */ -export function collectAndReturnViolation(path, ruleName, errorData) { - collector.add(EntryType.VIOLATION, path, ruleName); +export function collectAndReturnViolation(jsonPath, ruleName, errorData) { + collector.add(EntryType.VIOLATION, jsonPath, ruleName); if (typeof errorData === 'string') { return [{ message: errorData }]; @@ -26,23 +26,23 @@ export function collectAndReturnViolation(path, ruleName, errorData) { /** * Collects an adoption entry. * - * @param {Array} path - The JSON path for the object where the rule adoption occurred. + * @param {Array} jsonPath - The JSON path array for the object where the rule violation occurred. Example: ["paths","./pets","get"] * @param {string} ruleName - The name of the rule that was adopted. */ -export function collectAdoption(path, ruleName) { - collector.add(EntryType.ADOPTION, path, ruleName); +export function collectAdoption(jsonPath, ruleName) { + collector.add(EntryType.ADOPTION, jsonPath, ruleName); } /** * Collects an exception entry. * * @param object the object to evaluate - * @param {Array} path - The JSON path for the object where the rule exception occurred. + * @param {Array} jsonPath - The JSON path array for the object where the rule violation occurred. Example: ["paths","./pets","get"] * @param {string} ruleName - The name of the rule that the exception is defined for. */ -export function collectException(object, ruleName, path) { +export function collectException(object, ruleName, jsonPath) { let exceptionReason = object[EXCEPTION_EXTENSION][ruleName]; if (exceptionReason) { - collector.add(EntryType.EXCEPTION, path, ruleName, exceptionReason); + collector.add(EntryType.EXCEPTION, jsonPath, ruleName, exceptionReason); } }