From 5aae4f19cf3c8364c4a5c8004f3fd0110d8dba6c Mon Sep 17 00:00:00 2001 From: VijayKesharwani <122533719+VijayKesharwani@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:14:33 +0530 Subject: [PATCH] Update camara-casing-convention.js --- lint_function/camara-casing-convention.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lint_function/camara-casing-convention.js b/lint_function/camara-casing-convention.js index 54874c81e9..23da1861c5 100644 --- a/lint_function/camara-casing-convention.js +++ b/lint_function/camara-casing-convention.js @@ -1,13 +1,22 @@ // lint_function/camara-casing-convention.js + export default async function (input) { const errors = []; const suggestions = []; - for (const operationId of input) { - console.log(operationId); - if (!isCamelCase(operationId)) { - errors.push(operationId); - suggestions.push(`OperationId '${operationId}' should be in camelCase.`); + for (const path in input.paths) { + for (const method in input.paths[path]) { + const operation = input.paths[path][method]; + if (operation.operationId) { + const operationId = operation.operationId; + if (!isCamelCase(operationId)) { + errors.push(operationId); + suggestions.push(`OperationId '${operationId}' should be in camelCase.`); + } + } else { + errors.push('OperationId missing'); + suggestions.push(`OperationId is missing for the ${method} operation on path '${path}'.`); + } } }