From 65b20d2dde1556fbcc2e9fc43055c214a197e08a Mon Sep 17 00:00:00 2001 From: Sophia Marie Terry Date: Mon, 18 Aug 2025 12:17:57 +0100 Subject: [PATCH 1/7] Add ignore list and refactor logic into singularize method --- .../functions/utils/operationIdGeneration.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js index f25ca29bb5..e423b4fe1d 100644 --- a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js +++ b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js @@ -4,6 +4,9 @@ import { isPathParam, removePrefix, isSingleResourceIdentifier } from './resourc const CAMEL_CASE = /[A-Z]?[a-z]+/g; const CAMEL_CASE_WITH_ABBREVIATIONS = /[A-Z]+(?![a-z])|[A-Z]*[a-z]+/g; +// List of capitalized nouns that should not be pluralized in any case. +const IGNORE_LIST = ['Fts']; + /** * Returns IPA Compliant Operation ID. * @@ -40,7 +43,7 @@ export function generateOperationID(method, path) { let opID = verb; for (let i = 0; i < nouns.length - 1; i++) { - opID += inflection.singularize(nouns[i]); + opID += singularize(nouns[i]); } // singularize final noun, dependent on resource identifier - leave custom nouns alone @@ -49,7 +52,7 @@ export function generateOperationID(method, path) { !camelCaseCustomMethod) || verb === 'create' ) { - nouns[nouns.length - 1] = inflection.singularize(nouns[nouns.length - 1]); + nouns[nouns.length - 1] = singularize(nouns[nouns.length - 1]); } opID += nouns.pop(); @@ -92,3 +95,10 @@ function deriveActionVerb(method) { function capitalize(val) { return String(val).charAt(0).toUpperCase() + String(val).slice(1); } + +function singularize(noun) { + if (!IGNORE_LIST.includes(noun)) { + return inflection.singularize(noun); + } + return noun; +} From f1ec293ed1f29bf0c6a9d6e7eaf8572dcd49229e Mon Sep 17 00:00:00 2001 From: Sophia Terry <157913563+sphterry@users.noreply.github.com> Date: Mon, 18 Aug 2025 13:45:31 +0100 Subject: [PATCH 2/7] Update comment Co-authored-by: Lovisa Berggren <59226031+lovisaberggren@users.noreply.github.com> --- .../ipa/rulesets/functions/utils/operationIdGeneration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js index e423b4fe1d..801a178517 100644 --- a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js +++ b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js @@ -4,7 +4,7 @@ import { isPathParam, removePrefix, isSingleResourceIdentifier } from './resourc const CAMEL_CASE = /[A-Z]?[a-z]+/g; const CAMEL_CASE_WITH_ABBREVIATIONS = /[A-Z]+(?![a-z])|[A-Z]*[a-z]+/g; -// List of capitalized nouns that should not be pluralized in any case. +// List of capitalized nouns that should not be singularized in any case. const IGNORE_LIST = ['Fts']; /** From 97d448f100adf329e6e1bd610d92ed88f39e270e Mon Sep 17 00:00:00 2001 From: Sophia Marie Terry Date: Mon, 18 Aug 2025 12:21:40 +0100 Subject: [PATCH 3/7] PATCH version bump --- tools/spectral/ipa/package-lock.json | 4 ++-- tools/spectral/ipa/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/spectral/ipa/package-lock.json b/tools/spectral/ipa/package-lock.json index 0c8997a2e7..f1e99ca948 100644 --- a/tools/spectral/ipa/package-lock.json +++ b/tools/spectral/ipa/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mongodb-js/ipa-validation-ruleset", - "version": "0.0.1", + "version": "2.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mongodb-js/ipa-validation-ruleset", - "version": "0.0.1", + "version": "2.1.1", "license": "Apache-2.0", "dependencies": { "@stoplight/spectral-cli": "6.15.0", diff --git a/tools/spectral/ipa/package.json b/tools/spectral/ipa/package.json index bc72844bb7..607918770b 100644 --- a/tools/spectral/ipa/package.json +++ b/tools/spectral/ipa/package.json @@ -1,6 +1,6 @@ { "name": "@mongodb-js/ipa-validation-ruleset", - "version": "2.1.0", + "version": "2.1.1", "description": "Custom validation rules for MongoDB API Standards (IPA).", "keywords": [ "mongodb", From 1d6e1e48d4133a43b2dfed18cbe2991e4d8c820d Mon Sep 17 00:00:00 2001 From: Sophia Marie Terry Date: Tue, 19 Aug 2025 12:06:30 +0100 Subject: [PATCH 4/7] Move ignore list to functionOptions --- tools/spectral/ipa/rulesets/IPA-104.yaml | 2 ++ tools/spectral/ipa/rulesets/IPA-105.yaml | 2 ++ tools/spectral/ipa/rulesets/IPA-106.yaml | 2 ++ tools/spectral/ipa/rulesets/IPA-107.yaml | 2 ++ tools/spectral/ipa/rulesets/IPA-108.yaml | 2 ++ tools/spectral/ipa/rulesets/IPA-109.yaml | 3 +++ .../rulesets/functions/IPA104ValidOperationID.js | 4 ++-- .../rulesets/functions/IPA105ValidOperationID.js | 4 ++-- .../rulesets/functions/IPA106ValidOperationID.js | 4 ++-- .../rulesets/functions/IPA107ValidOperationID.js | 4 ++-- .../rulesets/functions/IPA108ValidOperationID.js | 4 ++-- .../rulesets/functions/IPA109ValidOperationID.js | 4 ++-- .../functions/utils/operationIdGeneration.js | 13 +++++-------- .../validateOperationIdAndReturnErrors.js | 4 ++-- 14 files changed, 32 insertions(+), 22 deletions(-) diff --git a/tools/spectral/ipa/rulesets/IPA-104.yaml b/tools/spectral/ipa/rulesets/IPA-104.yaml index fb7783a4dc..55fdd2b0ec 100644 --- a/tools/spectral/ipa/rulesets/IPA-104.yaml +++ b/tools/spectral/ipa/rulesets/IPA-104.yaml @@ -115,3 +115,5 @@ rules: function: 'IPA104ValidOperationID' functionOptions: methodName: 'get' + ignoreList: + - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-105.yaml b/tools/spectral/ipa/rulesets/IPA-105.yaml index d721b3c6b4..ee9b8936cc 100644 --- a/tools/spectral/ipa/rulesets/IPA-105.yaml +++ b/tools/spectral/ipa/rulesets/IPA-105.yaml @@ -95,3 +95,5 @@ rules: function: 'IPA105ValidOperationID' functionOptions: methodName: 'list' + ignoreList: + - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-106.yaml b/tools/spectral/ipa/rulesets/IPA-106.yaml index dafa6ce040..1e3d04c8dc 100644 --- a/tools/spectral/ipa/rulesets/IPA-106.yaml +++ b/tools/spectral/ipa/rulesets/IPA-106.yaml @@ -129,3 +129,5 @@ rules: function: 'IPA106ValidOperationID' functionOptions: methodName: 'create' + ignoreList: + - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-107.yaml b/tools/spectral/ipa/rulesets/IPA-107.yaml index 31fee52af9..c720a20141 100644 --- a/tools/spectral/ipa/rulesets/IPA-107.yaml +++ b/tools/spectral/ipa/rulesets/IPA-107.yaml @@ -130,3 +130,5 @@ rules: function: 'IPA107ValidOperationID' functionOptions: methodName: 'update' + ignoreList: + - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-108.yaml b/tools/spectral/ipa/rulesets/IPA-108.yaml index abc11f831b..6d1de08bd9 100644 --- a/tools/spectral/ipa/rulesets/IPA-108.yaml +++ b/tools/spectral/ipa/rulesets/IPA-108.yaml @@ -71,6 +71,8 @@ rules: function: 'IPA108ValidOperationID' functionOptions: methodName: 'delete' + ignoreList: + - 'Fts' functions: - IPA108DeleteMethodResponseShouldNotHaveSchema diff --git a/tools/spectral/ipa/rulesets/IPA-109.yaml b/tools/spectral/ipa/rulesets/IPA-109.yaml index e41d434d2a..a1f052fa46 100644 --- a/tools/spectral/ipa/rulesets/IPA-109.yaml +++ b/tools/spectral/ipa/rulesets/IPA-109.yaml @@ -75,3 +75,6 @@ rules: given: '$.paths[*][*]' then: function: 'IPA109ValidOperationID' + functionOptions: + ignoreList: + - 'Fts' diff --git a/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js index 5eb6c30a5d..caa61ead91 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js @@ -6,7 +6,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-104-valid-operation-id'; -export default (input, { methodName }, { path, documentInventory }) => { +export default (input, { methodName, ignoreList }, { path, documentInventory }) => { const resourcePath = path[1]; const oas = documentInventory.resolved; const resourcePaths = getResourcePathItems(resourcePath, oas.paths); @@ -23,7 +23,7 @@ export default (input, { methodName }, { path, documentInventory }) => { if (hasMethodVerbOverride(input, methodName)) { methodName = input[VERB_OVERRIDE_EXTENSION].verb; } - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { diff --git a/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js index 7b2a3d9b96..749b786bed 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js @@ -6,7 +6,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-105-valid-operation-id'; -export default (input, { methodName }, { path, documentInventory }) => { +export default (input, { methodName, ignoreList }, { path, documentInventory }) => { const resourcePath = path[1]; const oas = documentInventory.resolved; const resourcePaths = getResourcePathItems(resourcePath, oas.paths); @@ -24,7 +24,7 @@ export default (input, { methodName }, { path, documentInventory }) => { } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js index 47842e6adf..e8d41f1f4a 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-106-valid-operation-id'; -export default (input, { methodName }, { path }) => { +export default (input, { methodName, ignoreList }, { path }) => { const resourcePath = path[1]; if (hasCustomMethodOverride(input) || isCustomMethodIdentifier(resourcePath)) { @@ -17,7 +17,7 @@ export default (input, { methodName }, { path }) => { } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js index 65f1769ccb..1a0f50d17e 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-107-valid-operation-id'; -export default (input, { methodName }, { path }) => { +export default (input, { methodName, ignoreList }, { path }) => { const resourcePath = path[1]; if (isCustomMethodIdentifier(resourcePath) || hasCustomMethodOverride(input)) { @@ -17,7 +17,7 @@ export default (input, { methodName }, { path }) => { } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js index d306735575..d223c50660 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-108-valid-operation-id'; -export default (input, { methodName }, { path }) => { +export default (input, { methodName, ignoreList }, { path }) => { const resourcePath = path[1]; if (isCustomMethodIdentifier(resourcePath) || hasCustomMethodOverride(input)) { @@ -17,7 +17,7 @@ export default (input, { methodName }, { path }) => { } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js index 9be8269c49..480f6ee697 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-109-valid-operation-id'; -export default (input, _, { path }) => { +export default (input, { ignoreList }, { path }) => { const resourcePath = path[1]; if (!isCustomMethodIdentifier(resourcePath) && !hasCustomMethodOverride(input)) { @@ -28,7 +28,7 @@ export default (input, _, { path }) => { return; } - const errors = validateOperationIdAndReturnErrors(methodName, endpointUrl, input, path); + const errors = validateOperationIdAndReturnErrors(methodName, endpointUrl, input, path, ignoreList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js index 801a178517..7dfb853d1b 100644 --- a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js +++ b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js @@ -4,16 +4,13 @@ import { isPathParam, removePrefix, isSingleResourceIdentifier } from './resourc const CAMEL_CASE = /[A-Z]?[a-z]+/g; const CAMEL_CASE_WITH_ABBREVIATIONS = /[A-Z]+(?![a-z])|[A-Z]*[a-z]+/g; -// List of capitalized nouns that should not be singularized in any case. -const IGNORE_LIST = ['Fts']; - /** * Returns IPA Compliant Operation ID. * * @param method the standard method name (create, update, get etc.), custom method name, or empty string (only for legacy custom methods) * @param path the path for the endpoint */ -export function generateOperationID(method, path) { +export function generateOperationID(method, path, ignoreList = []) { if (!path) { return method; } @@ -43,7 +40,7 @@ export function generateOperationID(method, path) { let opID = verb; for (let i = 0; i < nouns.length - 1; i++) { - opID += singularize(nouns[i]); + opID += singularize(nouns[i], ignoreList); } // singularize final noun, dependent on resource identifier - leave custom nouns alone @@ -52,7 +49,7 @@ export function generateOperationID(method, path) { !camelCaseCustomMethod) || verb === 'create' ) { - nouns[nouns.length - 1] = singularize(nouns[nouns.length - 1]); + nouns[nouns.length - 1] = singularize(nouns[nouns.length - 1], ignoreList); } opID += nouns.pop(); @@ -96,8 +93,8 @@ function capitalize(val) { return String(val).charAt(0).toUpperCase() + String(val).slice(1); } -function singularize(noun) { - if (!IGNORE_LIST.includes(noun)) { +function singularize(noun, ignoreList = []) { + if (!ignoreList.includes(noun)) { return inflection.singularize(noun); } return noun; diff --git a/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js b/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js index 1bbf71e338..643bce889c 100644 --- a/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js +++ b/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js @@ -18,9 +18,9 @@ const TOO_LONG_OP_ID_ERROR_MESSAGE = * @param path the path to the operation object being evaluated, used for error reporting with Spectral. * @returns {[{path: string[], message: string}]} an array of error objects, each containing a path and a message, or an empty array if no errors are found. */ -export function validateOperationIdAndReturnErrors(methodName, resourcePath, operationObject, path) { +export function validateOperationIdAndReturnErrors(methodName, resourcePath, operationObject, path, ignoreList) { const operationId = operationObject.operationId; - const expectedOperationId = generateOperationID(methodName, resourcePath); + const expectedOperationId = generateOperationID(methodName, resourcePath, ignoreList); const operationIdPath = path.concat(['operationId']); From 692d9744d4bab1081274b45257d143a5a23709b2 Mon Sep 17 00:00:00 2001 From: Sophia Marie Terry Date: Tue, 19 Aug 2025 12:15:40 +0100 Subject: [PATCH 5/7] Add tests for ignoreList --- .../ipa/__tests__/IPA104ValidOperationID.test.js | 14 ++++++++++++++ .../ipa/__tests__/IPA105ValidOperationID.test.js | 14 ++++++++++++++ .../ipa/__tests__/IPA106ValidOperationID.test.js | 14 ++++++++++++++ .../ipa/__tests__/IPA107ValidOperationID.test.js | 14 ++++++++++++++ .../ipa/__tests__/IPA108ValidOperationID.test.js | 14 ++++++++++++++ .../ipa/__tests__/IPA109ValidOperationID.test.js | 14 ++++++++++++++ 6 files changed, 84 insertions(+) diff --git a/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js index 06b6be8f40..1ecc24552c 100644 --- a/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js @@ -145,4 +145,18 @@ testRule('xgen-IPA-104-valid-operation-id', [ }, errors: [], }, + { + name: 'valid method that needs ignoreList', + document: { + paths: { + '/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId} ': { + get: { + operationId: 'getGroupClusterFtsIndex', + 'x-xgen-operation-id-override': 'getClusterFtsIndex', + }, + }, + }, + }, + errors: [], + }, ]); diff --git a/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js index ec6ad1c05c..6bf654c213 100644 --- a/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js @@ -136,4 +136,18 @@ testRule('xgen-IPA-105-valid-operation-id', [ }, errors: [], }, + { + name: 'valid method that needs ignoreList', + document: { + paths: { + '/api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics': { + get: { + operationId: 'listGroupHostFtsMetrics', + 'x-xgen-operation-id-override': 'listHostFtsMetrics', + }, + }, + }, + }, + errors: [], + }, ]); diff --git a/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js index 5ba1471394..7c97022698 100644 --- a/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js @@ -168,4 +168,18 @@ testRule('xgen-IPA-106-valid-operation-id', [ }, errors: [], }, + { + name: 'valid method that needs ignoreList', + document: { + paths: { + '/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes': { + post: { + operationId: 'createGroupClusterFtsIndex', + 'x-xgen-operation-id-override': 'createClusterFtsIndex', + }, + }, + }, + }, + errors: [], + }, ]); diff --git a/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js index 5eca9ce856..5c4885ec97 100644 --- a/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js @@ -162,4 +162,18 @@ testRule('xgen-IPA-107-valid-operation-id', [ }, errors: [], }, + { + name: 'valid method that needs ignoreList', + document: { + paths: { + '/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId}': { + put: { + operationId: 'updateGroupClusterFtsIndex', + 'x-xgen-operation-id-override': 'updateClusterFtsIndex', + }, + }, + }, + }, + errors: [], + }, ]); diff --git a/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js index 0f193ca39d..161fa15cff 100644 --- a/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js @@ -167,4 +167,18 @@ testRule('xgen-IPA-108-valid-operation-id', [ }, errors: [], }, + { + name: 'valid method that needs ignoreList', + document: { + paths: { + '/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId}': { + delete: { + operationId: 'deleteGroupClusterFtsIndex', + 'x-xgen-operation-id-override': 'deleteClusterFtsIndex', + }, + }, + }, + }, + errors: [], + }, ]); diff --git a/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js index bb768016b4..d5aa026fd2 100644 --- a/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js @@ -137,4 +137,18 @@ testRule('xgen-IPA-109-valid-operation-id', [ }, errors: [], }, + { + name: 'valid method that needs ignoreList', + document: { + paths: { + '/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId}:test': { + delete: { + operationId: 'testGroupClusterFtsIndex', + 'x-xgen-operation-id-override': 'testClusterFtsIndex', + }, + }, + }, + }, + errors: [], + }, ]); From dd8b4042f62b7d1b2b10a88505e18d9b7d2366dc Mon Sep 17 00:00:00 2001 From: Sophia Marie Terry Date: Tue, 19 Aug 2025 12:17:37 +0100 Subject: [PATCH 6/7] Revert "PATCH version bump" This reverts commit 97d448f100adf329e6e1bd610d92ed88f39e270e. --- tools/spectral/ipa/package-lock.json | 4 ++-- tools/spectral/ipa/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/spectral/ipa/package-lock.json b/tools/spectral/ipa/package-lock.json index f1e99ca948..0c8997a2e7 100644 --- a/tools/spectral/ipa/package-lock.json +++ b/tools/spectral/ipa/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mongodb-js/ipa-validation-ruleset", - "version": "2.1.1", + "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mongodb-js/ipa-validation-ruleset", - "version": "2.1.1", + "version": "0.0.1", "license": "Apache-2.0", "dependencies": { "@stoplight/spectral-cli": "6.15.0", diff --git a/tools/spectral/ipa/package.json b/tools/spectral/ipa/package.json index 607918770b..bc72844bb7 100644 --- a/tools/spectral/ipa/package.json +++ b/tools/spectral/ipa/package.json @@ -1,6 +1,6 @@ { "name": "@mongodb-js/ipa-validation-ruleset", - "version": "2.1.1", + "version": "2.1.0", "description": "Custom validation rules for MongoDB API Standards (IPA).", "keywords": [ "mongodb", From 506eec045b89f83a7ea2362963c8f96c5d59ff37 Mon Sep 17 00:00:00 2001 From: Sophia Marie Terry Date: Tue, 19 Aug 2025 17:35:11 +0100 Subject: [PATCH 7/7] Alter name to 'ignorePluralizationList' and add documentation --- tools/spectral/ipa/rulesets/IPA-104.yaml | 7 ++++- tools/spectral/ipa/rulesets/IPA-105.yaml | 7 ++++- tools/spectral/ipa/rulesets/IPA-106.yaml | 7 ++++- tools/spectral/ipa/rulesets/IPA-107.yaml | 7 ++++- tools/spectral/ipa/rulesets/IPA-108.yaml | 6 +++- tools/spectral/ipa/rulesets/IPA-109.yaml | 6 +++- tools/spectral/ipa/rulesets/README.md | 28 +++++++++++++++++++ .../functions/IPA104ValidOperationID.js | 4 +-- .../functions/IPA105ValidOperationID.js | 4 +-- .../functions/IPA106ValidOperationID.js | 4 +-- .../functions/IPA107ValidOperationID.js | 4 +-- .../functions/IPA108ValidOperationID.js | 4 +-- .../functions/IPA109ValidOperationID.js | 4 +-- .../functions/utils/operationIdGeneration.js | 10 +++---- .../validateOperationIdAndReturnErrors.js | 10 +++++-- 15 files changed, 87 insertions(+), 25 deletions(-) diff --git a/tools/spectral/ipa/rulesets/IPA-104.yaml b/tools/spectral/ipa/rulesets/IPA-104.yaml index 55fdd2b0ec..9053f87e66 100644 --- a/tools/spectral/ipa/rulesets/IPA-104.yaml +++ b/tools/spectral/ipa/rulesets/IPA-104.yaml @@ -108,6 +108,11 @@ rules: Rule checks for the following conditions: - Applies only to GET methods on single resources or singleton resources - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId + + ##### Configuration + This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-104-valid-operation-id' severity: warn given: '#GetOperationObject' @@ -115,5 +120,5 @@ rules: function: 'IPA104ValidOperationID' functionOptions: methodName: 'get' - ignoreList: + ignorePluralizationList: - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-105.yaml b/tools/spectral/ipa/rulesets/IPA-105.yaml index ee9b8936cc..4cd05a8d71 100644 --- a/tools/spectral/ipa/rulesets/IPA-105.yaml +++ b/tools/spectral/ipa/rulesets/IPA-105.yaml @@ -88,6 +88,11 @@ rules: - Applies only to GET methods on resource collection paths - Ignores singleton resources - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId + + ##### Configuration + This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-105-valid-operation-id' severity: warn given: '#GetOperationObject' @@ -95,5 +100,5 @@ rules: function: 'IPA105ValidOperationID' functionOptions: methodName: 'list' - ignoreList: + ignorePluralizationList: - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-106.yaml b/tools/spectral/ipa/rulesets/IPA-106.yaml index 1e3d04c8dc..2938c632ac 100644 --- a/tools/spectral/ipa/rulesets/IPA-106.yaml +++ b/tools/spectral/ipa/rulesets/IPA-106.yaml @@ -122,6 +122,11 @@ rules: Rule checks for the following conditions: - Applies only to POST methods that are not [custom methods](https://mongodb.github.io/ipa/109) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId + + ##### Configuration + This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-valid-operation-id' severity: warn given: '#CreateOperationObject' @@ -129,5 +134,5 @@ rules: function: 'IPA106ValidOperationID' functionOptions: methodName: 'create' - ignoreList: + ignorePluralizationList: - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-107.yaml b/tools/spectral/ipa/rulesets/IPA-107.yaml index c720a20141..0f4f377999 100644 --- a/tools/spectral/ipa/rulesets/IPA-107.yaml +++ b/tools/spectral/ipa/rulesets/IPA-107.yaml @@ -123,6 +123,11 @@ rules: Rule checks for the following conditions: - Applies only to PUT/PATCH methods that are not [custom methods](https://mongodb.github.io/ipa/109) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId + + ##### Configuration + This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-valid-operation-id' severity: warn given: '#UpdateOperationObject' @@ -130,5 +135,5 @@ rules: function: 'IPA107ValidOperationID' functionOptions: methodName: 'update' - ignoreList: + ignorePluralizationList: - 'Fts' diff --git a/tools/spectral/ipa/rulesets/IPA-108.yaml b/tools/spectral/ipa/rulesets/IPA-108.yaml index 6d1de08bd9..78f3977977 100644 --- a/tools/spectral/ipa/rulesets/IPA-108.yaml +++ b/tools/spectral/ipa/rulesets/IPA-108.yaml @@ -64,6 +64,10 @@ rules: Rule checks for the following conditions: - Applies only to DELETE methods that are not [custom methods](https://mongodb.github.io/ipa/109) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId + ##### Configuration + This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-108-valid-operation-id' severity: warn given: '#DeleteOperationObject' @@ -71,7 +75,7 @@ rules: function: 'IPA108ValidOperationID' functionOptions: methodName: 'delete' - ignoreList: + ignorePluralizationList: - 'Fts' functions: diff --git a/tools/spectral/ipa/rulesets/IPA-109.yaml b/tools/spectral/ipa/rulesets/IPA-109.yaml index a1f052fa46..08b72e8509 100644 --- a/tools/spectral/ipa/rulesets/IPA-109.yaml +++ b/tools/spectral/ipa/rulesets/IPA-109.yaml @@ -70,11 +70,15 @@ rules: Rule checks for the following conditions: - Applies only to paths containing custom method identifiers (with colon format) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId + + ##### Configuration + This rule includes one configuration options: + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-109-valid-operation-id' severity: warn given: '$.paths[*][*]' then: function: 'IPA109ValidOperationID' functionOptions: - ignoreList: + ignorePluralizationList: - 'Fts' diff --git a/tools/spectral/ipa/rulesets/README.md b/tools/spectral/ipa/rulesets/README.md index d97328faef..c61ec2b66e 100644 --- a/tools/spectral/ipa/rulesets/README.md +++ b/tools/spectral/ipa/rulesets/README.md @@ -154,6 +154,11 @@ Rule checks for the following conditions: - Applies only to GET methods on single resources or singleton resources - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId +##### Configuration +This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") + ### IPA-105 @@ -220,6 +225,11 @@ Rule checks for the following conditions: - Ignores singleton resources - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId +##### Configuration +This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") + ### IPA-106 @@ -311,6 +321,11 @@ Rule checks for the following conditions: - Applies only to POST methods that are not [custom methods](https://mongodb.github.io/ipa/109) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId +##### Configuration +This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") + ### IPA-107 @@ -394,6 +409,11 @@ Rule checks for the following conditions: - Applies only to PUT/PATCH methods that are not [custom methods](https://mongodb.github.io/ipa/109) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId +##### Configuration +This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") + ### IPA-108 @@ -448,6 +468,10 @@ The noun(s) in the Operation ID should be the collection identifiers from the re Rule checks for the following conditions: - Applies only to DELETE methods that are not [custom methods](https://mongodb.github.io/ipa/109) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId +##### Configuration +This rule includes two configuration options: + - `methodName`: The verb to be used in the OperationIds + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") @@ -509,6 +533,10 @@ Rule checks for the following conditions: - Applies only to paths containing custom method identifiers (with colon format) - Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId +##### Configuration +This rule includes one configuration options: + - `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts") + ### IPA-110 diff --git a/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js index caa61ead91..370dd963ef 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js @@ -6,7 +6,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-104-valid-operation-id'; -export default (input, { methodName, ignoreList }, { path, documentInventory }) => { +export default (input, { methodName, ignorePluralizationList }, { path, documentInventory }) => { const resourcePath = path[1]; const oas = documentInventory.resolved; const resourcePaths = getResourcePathItems(resourcePath, oas.paths); @@ -23,7 +23,7 @@ export default (input, { methodName, ignoreList }, { path, documentInventory }) if (hasMethodVerbOverride(input, methodName)) { methodName = input[VERB_OVERRIDE_EXTENSION].verb; } - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { diff --git a/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js index 749b786bed..566b833a90 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js @@ -6,7 +6,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-105-valid-operation-id'; -export default (input, { methodName, ignoreList }, { path, documentInventory }) => { +export default (input, { methodName, ignorePluralizationList }, { path, documentInventory }) => { const resourcePath = path[1]; const oas = documentInventory.resolved; const resourcePaths = getResourcePathItems(resourcePath, oas.paths); @@ -24,7 +24,7 @@ export default (input, { methodName, ignoreList }, { path, documentInventory }) } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js index e8d41f1f4a..6a2157997b 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-106-valid-operation-id'; -export default (input, { methodName, ignoreList }, { path }) => { +export default (input, { methodName, ignorePluralizationList }, { path }) => { const resourcePath = path[1]; if (hasCustomMethodOverride(input) || isCustomMethodIdentifier(resourcePath)) { @@ -17,7 +17,7 @@ export default (input, { methodName, ignoreList }, { path }) => { } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js index 1a0f50d17e..c539793af9 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA107ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-107-valid-operation-id'; -export default (input, { methodName, ignoreList }, { path }) => { +export default (input, { methodName, ignorePluralizationList }, { path }) => { const resourcePath = path[1]; if (isCustomMethodIdentifier(resourcePath) || hasCustomMethodOverride(input)) { @@ -17,7 +17,7 @@ export default (input, { methodName, ignoreList }, { path }) => { } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js index d223c50660..0739fb338d 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA108ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-108-valid-operation-id'; -export default (input, { methodName, ignoreList }, { path }) => { +export default (input, { methodName, ignorePluralizationList }, { path }) => { const resourcePath = path[1]; if (isCustomMethodIdentifier(resourcePath) || hasCustomMethodOverride(input)) { @@ -17,7 +17,7 @@ export default (input, { methodName, ignoreList }, { path }) => { } try { - const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList); + const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js b/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js index 480f6ee697..fc798a334c 100644 --- a/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js +++ b/tools/spectral/ipa/rulesets/functions/IPA109ValidOperationID.js @@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate const RULE_NAME = 'xgen-IPA-109-valid-operation-id'; -export default (input, { ignoreList }, { path }) => { +export default (input, { ignorePluralizationList }, { path }) => { const resourcePath = path[1]; if (!isCustomMethodIdentifier(resourcePath) && !hasCustomMethodOverride(input)) { @@ -28,7 +28,7 @@ export default (input, { ignoreList }, { path }) => { return; } - const errors = validateOperationIdAndReturnErrors(methodName, endpointUrl, input, path, ignoreList); + const errors = validateOperationIdAndReturnErrors(methodName, endpointUrl, input, path, ignorePluralizationList); return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path); } catch (e) { return handleInternalError(RULE_NAME, path, e); diff --git a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js index 7dfb853d1b..5471455677 100644 --- a/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js +++ b/tools/spectral/ipa/rulesets/functions/utils/operationIdGeneration.js @@ -10,7 +10,7 @@ const CAMEL_CASE_WITH_ABBREVIATIONS = /[A-Z]+(?![a-z])|[A-Z]*[a-z]+/g; * @param method the standard method name (create, update, get etc.), custom method name, or empty string (only for legacy custom methods) * @param path the path for the endpoint */ -export function generateOperationID(method, path, ignoreList = []) { +export function generateOperationID(method, path, ignorePluralizationList = []) { if (!path) { return method; } @@ -40,7 +40,7 @@ export function generateOperationID(method, path, ignoreList = []) { let opID = verb; for (let i = 0; i < nouns.length - 1; i++) { - opID += singularize(nouns[i], ignoreList); + opID += singularize(nouns[i], ignorePluralizationList); } // singularize final noun, dependent on resource identifier - leave custom nouns alone @@ -49,7 +49,7 @@ export function generateOperationID(method, path, ignoreList = []) { !camelCaseCustomMethod) || verb === 'create' ) { - nouns[nouns.length - 1] = singularize(nouns[nouns.length - 1], ignoreList); + nouns[nouns.length - 1] = singularize(nouns[nouns.length - 1], ignorePluralizationList); } opID += nouns.pop(); @@ -93,8 +93,8 @@ function capitalize(val) { return String(val).charAt(0).toUpperCase() + String(val).slice(1); } -function singularize(noun, ignoreList = []) { - if (!ignoreList.includes(noun)) { +function singularize(noun, ignorePluralizationList = []) { + if (!ignorePluralizationList.includes(noun)) { return inflection.singularize(noun); } return noun; diff --git a/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js b/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js index 643bce889c..daa7b1cb9d 100644 --- a/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js +++ b/tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js @@ -18,9 +18,15 @@ const TOO_LONG_OP_ID_ERROR_MESSAGE = * @param path the path to the operation object being evaluated, used for error reporting with Spectral. * @returns {[{path: string[], message: string}]} an array of error objects, each containing a path and a message, or an empty array if no errors are found. */ -export function validateOperationIdAndReturnErrors(methodName, resourcePath, operationObject, path, ignoreList) { +export function validateOperationIdAndReturnErrors( + methodName, + resourcePath, + operationObject, + path, + ignorePluralizationList +) { const operationId = operationObject.operationId; - const expectedOperationId = generateOperationID(methodName, resourcePath, ignoreList); + const expectedOperationId = generateOperationID(methodName, resourcePath, ignorePluralizationList); const operationIdPath = path.concat(['operationId']);