diff --git a/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js index 47b3e70cb3..aaaf1122bf 100644 --- a/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js @@ -31,7 +31,7 @@ testRule('xgen-IPA-104-valid-operation-id', [ code: 'xgen-IPA-104-valid-operation-id', message: "Invalid OperationID. Found 'getProjectIpList', expected 'getGroupAccessList'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/accessList/{entryValue}', 'get', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -52,14 +52,14 @@ testRule('xgen-IPA-104-valid-operation-id', [ message: "Invalid OperationID. Found 'listAlertConfigurationsByAlertId', expected 'getGroupAlertAlertConfigs'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/alerts/{alertId}/alertConfigs', 'get', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-104-valid-operation-id', message: "The Operation ID is longer than 4 words. Please add an 'x-xgen-operation-id-override' extension to the operation with a shorter operation ID. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/alerts/{alertId}/alertConfigs', 'get', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -109,7 +109,7 @@ testRule('xgen-IPA-104-valid-operation-id', [ 'get', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-104-valid-operation-id', @@ -120,7 +120,7 @@ testRule('xgen-IPA-104-valid-operation-id', [ 'get', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js index 7121dfe5c3..b5b2466f9e 100644 --- a/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA105ValidOperationID.test.js @@ -31,7 +31,7 @@ testRule('xgen-IPA-105-valid-operation-id', [ code: 'xgen-IPA-105-valid-operation-id', message: "Invalid OperationID. Found 'getApiVersions', expected 'listOpenapiVersions'. ", path: ['paths', '/api/atlas/v2/unauth/openapi/versions', 'get', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -52,14 +52,14 @@ testRule('xgen-IPA-105-valid-operation-id', [ message: "Invalid OperationID. Found 'returnAllControlPlaneIpAddresses', expected 'listControlPlaneIpAddresses'. ", path: ['paths', '/api/atlas/v2/unauth/controlPlaneIPAddresses', 'get', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-105-valid-operation-id', message: "The Operation ID is longer than 4 words. Please add an 'x-xgen-operation-id-override' extension to the operation with a shorter operation ID. ", path: ['paths', '/api/atlas/v2/unauth/controlPlaneIPAddresses', 'get', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -101,13 +101,13 @@ testRule('xgen-IPA-105-valid-operation-id', [ message: "The operation ID override must only contain nouns from the operation ID 'listGroupBackupExportBuckets'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/backup/exportBuckets', 'get', 'x-xgen-operation-id-override'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-105-valid-operation-id', message: "The operation ID override must end with the noun 'Buckets'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/backup/exportBuckets', 'get', 'x-xgen-operation-id-override'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js index 7c97022698..4fad9067d2 100644 --- a/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA106ValidOperationID.test.js @@ -36,13 +36,13 @@ testRule('xgen-IPA-106-valid-operation-id', [ code: 'xgen-IPA-106-valid-operation-id', message: "Invalid OperationID. Found 'addUserToProject', expected 'createGroupAccess'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/access', 'post', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-valid-operation-id', message: "Invalid OperationID. Found 'createProjectInvitation', expected 'createGroupInvite'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/invites', 'post', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -63,14 +63,14 @@ testRule('xgen-IPA-106-valid-operation-id', [ message: "Invalid OperationID. Found 'createServiceAccountAccessList', expected 'createOrgServiceAccountAccessList'. ", path: ['paths', '/api/atlas/v2/orgs/{orgId}/serviceAccounts/{clientId}/accessList', 'post', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-valid-operation-id', message: "The Operation ID is longer than 4 words. Please add an 'x-xgen-operation-id-override' extension to the operation with a shorter operation ID. ", path: ['paths', '/api/atlas/v2/orgs/{orgId}/serviceAccounts/{clientId}/accessList', 'post', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -110,7 +110,7 @@ testRule('xgen-IPA-106-valid-operation-id', [ 'post', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-valid-operation-id', @@ -122,7 +122,7 @@ testRule('xgen-IPA-106-valid-operation-id', [ 'post', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-valid-operation-id', @@ -133,7 +133,7 @@ testRule('xgen-IPA-106-valid-operation-id', [ 'post', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -144,7 +144,10 @@ testRule('xgen-IPA-106-valid-operation-id', [ '/api/atlas/v2/groups/{groupId}/serverless': { post: { operationId: 'createGroupServerlessInstance', - 'x-xgen-method-verb-override': { verb: 'createInstance', customMethod: false }, + 'x-xgen-method-verb-override': { + verb: 'createInstance', + customMethod: false, + }, 'x-xgen-operation-id-override': 'createServerlessInstance', }, }, diff --git a/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js index 5c4885ec97..eb3d99ae48 100644 --- a/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA107ValidOperationID.test.js @@ -41,13 +41,13 @@ testRule('xgen-IPA-107-valid-operation-id', [ code: 'xgen-IPA-107-valid-operation-id', message: "Invalid OperationID. Found 'setProjectLimit', expected 'updateGroupLimit'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/limits/{limitName}', 'patch', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-valid-operation-id', message: "Invalid OperationID. Found 'updateProjectSettings', expected 'updateGroupSettings'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/settings', 'put', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -68,14 +68,14 @@ testRule('xgen-IPA-107-valid-operation-id', [ message: "Invalid OperationID. Found 'updatePushBasedLogConfiguration', expected 'updateGroupPushBasedLogExport'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/pushBasedLogExport', 'patch', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-valid-operation-id', message: "The Operation ID is longer than 4 words. Please add an 'x-xgen-operation-id-override' extension to the operation with a shorter operation ID. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/pushBasedLogExport', 'patch', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -116,7 +116,7 @@ testRule('xgen-IPA-107-valid-operation-id', [ 'patch', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-valid-operation-id', @@ -127,7 +127,7 @@ testRule('xgen-IPA-107-valid-operation-id', [ 'patch', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -138,7 +138,10 @@ testRule('xgen-IPA-107-valid-operation-id', [ '/api/atlas/v2/groups/{groupId}/serverless': { patch: { operationId: 'updateGroupServerlessInstance', - 'x-xgen-method-verb-override': { verb: 'updateInstance', customMethod: false }, + 'x-xgen-method-verb-override': { + verb: 'updateInstance', + customMethod: false, + }, 'x-xgen-operation-id-override': 'updateServerlessInstance', }, }, diff --git a/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js index 161fa15cff..53a4647beb 100644 --- a/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA108ValidOperationID.test.js @@ -36,13 +36,13 @@ testRule('xgen-IPA-108-valid-operation-id', [ code: 'xgen-IPA-108-valid-operation-id', message: "Invalid OperationID. Found 'removeProjectApiKey', expected 'deleteGroupApiKey'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}', 'delete', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-108-valid-operation-id', message: "Invalid OperationID. Found 'deleteProject', expected 'deleteGroup'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}', 'delete', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -68,7 +68,7 @@ testRule('xgen-IPA-108-valid-operation-id', [ 'delete', 'operationId', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-108-valid-operation-id', @@ -80,7 +80,7 @@ testRule('xgen-IPA-108-valid-operation-id', [ 'delete', 'operationId', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -121,7 +121,7 @@ testRule('xgen-IPA-108-valid-operation-id', [ 'delete', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-108-valid-operation-id', @@ -132,7 +132,7 @@ testRule('xgen-IPA-108-valid-operation-id', [ 'delete', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -143,7 +143,10 @@ testRule('xgen-IPA-108-valid-operation-id', [ '/api/atlas/v2/groups/{groupId}/serverless': { delete: { operationId: 'deleteGroupServerlessInstance', - 'x-xgen-method-verb-override': { verb: 'deleteInstance', customMethod: false }, + 'x-xgen-method-verb-override': { + verb: 'deleteInstance', + customMethod: false, + }, 'x-xgen-operation-id-override': 'deleteServerlessInstance', }, }, diff --git a/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js b/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js index 0bd9659262..1055669191 100644 --- a/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js +++ b/tools/spectral/ipa/__tests__/IPA109ValidOperationID.test.js @@ -36,7 +36,7 @@ testRule('xgen-IPA-109-valid-operation-id', [ code: 'xgen-IPA-109-valid-operation-id', message: "Invalid OperationID. Found 'searchClusters', expected 'searchGroupClusters'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}/clusters:search', 'post', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -56,14 +56,14 @@ testRule('xgen-IPA-109-valid-operation-id', [ code: 'xgen-IPA-109-valid-operation-id', message: "Invalid OperationID. Found 'migrateProjectToAnotherOrg', expected 'migrateGroup'. ", path: ['paths', '/api/atlas/v2/groups/{groupId}:migrate', 'post', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-109-valid-operation-id', message: "The Operation ID is longer than 4 words. Please add an 'x-xgen-operation-id-override' extension to the operation with a shorter operation ID. ", path: ['paths', '/api/atlas/v2/groups/{groupId}:migrate', 'post', 'operationId'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -118,7 +118,7 @@ testRule('xgen-IPA-109-valid-operation-id', [ 'delete', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-109-valid-operation-id', @@ -129,7 +129,7 @@ testRule('xgen-IPA-109-valid-operation-id', [ 'delete', 'x-xgen-operation-id-override', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/metrics/data/collector-results.log b/tools/spectral/ipa/__tests__/metrics/data/collector-results.log index 7545026c1e..5cf7da7bf4 100644 --- a/tools/spectral/ipa/__tests__/metrics/data/collector-results.log +++ b/tools/spectral/ipa/__tests__/metrics/data/collector-results.log @@ -3,7 +3,12 @@ { "componentId": "paths./api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}.get", "ruleName": "xgen-IPA-104-valid-operation-id" - }], + }, + { + "componentId": "paths./api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}.get", + "ruleName": "xgen-IPA-104-valid-operation-id-warn" + } + ], "adoptions": [ { "componentId": "paths./api/atlas/v2", diff --git a/tools/spectral/ipa/__tests__/metrics/data/expected-metric-results.json b/tools/spectral/ipa/__tests__/metrics/data/expected-metric-results.json index 328b6319c5..b8b78e345c 100644 --- a/tools/spectral/ipa/__tests__/metrics/data/expected-metric-results.json +++ b/tools/spectral/ipa/__tests__/metrics/data/expected-metric-results.json @@ -1752,6 +1752,16 @@ "component_id": "paths./api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}.get", "ipa_rule": "xgen-IPA-104-valid-operation-id", "ipa": "IPA-104", + "severity_level": "error", + "adoption_status": "violated", + "exception_reason": null, + "owner_team": null, + "timestamp": "2025-01-21T16:45:11.681Z" + }, + { + "component_id": "paths./api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}.get", + "ipa_rule": "xgen-IPA-104-valid-operation-id-warn", + "ipa": "IPA-104", "severity_level": "warn", "adoption_status": "violated", "exception_reason": null, diff --git a/tools/spectral/ipa/__tests__/metrics/data/test-ipa-spectral.yaml b/tools/spectral/ipa/__tests__/metrics/data/test-ipa-spectral.yaml index 413a2720ca..0b9e0a8d00 100644 --- a/tools/spectral/ipa/__tests__/metrics/data/test-ipa-spectral.yaml +++ b/tools/spectral/ipa/__tests__/metrics/data/test-ipa-spectral.yaml @@ -1,2 +1,24 @@ extends: - ../../../rulesets/IPA-104.yaml + +functionsDir: '../../../rulesets/functions' + +functions: + - IPA104ValidOperationID + +aliases: + GetOperationObject: + - '$.paths[*].get' + +rules: + xgen-IPA-104-valid-operation-id-warn: + description: Test rule as warning for testing purposes + message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-104-valid-operation-id' + severity: warn + given: '#GetOperationObject' + then: + function: 'IPA104ValidOperationID' + functionOptions: + methodName: 'get' + ignoreSingularizationList: + - 'Fts' diff --git a/tools/spectral/ipa/__tests__/metrics/metricCollection.test.js b/tools/spectral/ipa/__tests__/metrics/metricCollection.test.js index d3de718b20..37ffdc1af7 100644 --- a/tools/spectral/ipa/__tests__/metrics/metricCollection.test.js +++ b/tools/spectral/ipa/__tests__/metrics/metricCollection.test.js @@ -44,7 +44,7 @@ describe('tools/spectral/ipa/metrics/metricCollection.js runMetricCollectionJob' expect(results.warnings.count).toEqual(1); const violations = [ { - code: 'xgen-IPA-104-valid-operation-id', + code: 'xgen-IPA-104-valid-operation-id-warn', }, ]; expect(results.warnings.violations).toEqual(violations); diff --git a/tools/spectral/ipa/ipa-spectral.yaml b/tools/spectral/ipa/ipa-spectral.yaml index 2bad9e8f9e..a8164e9f8a 100644 --- a/tools/spectral/ipa/ipa-spectral.yaml +++ b/tools/spectral/ipa/ipa-spectral.yaml @@ -214,7 +214,39 @@ overrides: - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1customDBRoles~1roles~1%7BroleName%7D' rules: xgen-IPA-102-collection-identifier-camelCase: 'off' - - files: + - files: # To be removed in CLOUDP-338425 - '**' # Matches all files rules: xgen-IPA-005-exception-extension-format: 'off' + - files: # To be removed in CLOUDP-338425 when op ID changes are propagated to prod OAS + - '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1ratelimits/get' + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1ratelimits/get' + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1hosts~1%7BprocessId%7D~1fts~1metrics~1indexes~1%7BdatabaseName%7D~1%7BcollectionName%7D~1measurements/get' + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayAttachments~1%7BattachmentId%7D/get' + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1clusters~1%7BclusterName%7D~1search~1indexes~1%7BdatabaseName%7D~1%7BcollectionName%7D' + rules: + xgen-IPA-104-valid-operation-id: 'off' + - files: # To be removed in CLOUDP-338425 when op ID changes are propagated to prod OAS + - '**#/paths/~1api~1atlas~1v2~1unauth~1ratelimits/get' + - '**#/paths/~1api~1atlas~1v2~1ratelimits/get' + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayAttachments/get' + - '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1apiKeys~1%7BapiUserId%7D~1accessList/get' + - '**#/paths/~1api~1atlas~1v2/get' + rules: + xgen-IPA-105-valid-operation-id: 'off' + - files: # To be removed in CLOUDP-338425 when op ID changes are propagated to prod OAS + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayAttachments/post' + rules: + xgen-IPA-106-valid-operation-id: 'off' + - files: # To be removed in CLOUDP-338425 when op ID changes are propagated to prod OAS + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streams~1%7BtenantName%7D/patch' + rules: + xgen-IPA-107-valid-operation-id: 'off' + - files: # To be removed in CLOUDP-338425 when op ID changes are propagated to prod OAS + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayAttachments~1%7BattachmentId%7D/delete' + rules: + xgen-IPA-108-valid-operation-id: 'off' + - files: # To be removed in CLOUDP-338425 when op ID changes are propagated to prod OAS + - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayInvitations%3Areject/post' + rules: + xgen-IPA-109-valid-operation-id: 'off' diff --git a/tools/spectral/ipa/rulesets/IPA-104.yaml b/tools/spectral/ipa/rulesets/IPA-104.yaml index ca137a82e9..916f858be4 100644 --- a/tools/spectral/ipa/rulesets/IPA-104.yaml +++ b/tools/spectral/ipa/rulesets/IPA-104.yaml @@ -114,7 +114,7 @@ rules: - `methodName`: The verb to be used in the OperationIds - `ignoreSingularizationList`: 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 + severity: error given: '#GetOperationObject' then: function: 'IPA104ValidOperationID' diff --git a/tools/spectral/ipa/rulesets/IPA-105.yaml b/tools/spectral/ipa/rulesets/IPA-105.yaml index b8e2174e4f..26047a04fd 100644 --- a/tools/spectral/ipa/rulesets/IPA-105.yaml +++ b/tools/spectral/ipa/rulesets/IPA-105.yaml @@ -94,7 +94,7 @@ rules: - `methodName`: The verb to be used in the OperationIds - `ignoreSingularizationList`: 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 + severity: error given: '#GetOperationObject' then: function: 'IPA105ValidOperationID' diff --git a/tools/spectral/ipa/rulesets/IPA-106.yaml b/tools/spectral/ipa/rulesets/IPA-106.yaml index 12cabe72a9..f9bd8e4d0d 100644 --- a/tools/spectral/ipa/rulesets/IPA-106.yaml +++ b/tools/spectral/ipa/rulesets/IPA-106.yaml @@ -128,7 +128,7 @@ rules: - `methodName`: The verb to be used in the OperationIds - `ignoreSingularizationList`: 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 + severity: error given: '#CreateOperationObject' then: function: 'IPA106ValidOperationID' diff --git a/tools/spectral/ipa/rulesets/IPA-107.yaml b/tools/spectral/ipa/rulesets/IPA-107.yaml index 74f1850ec5..ca7d2d6721 100644 --- a/tools/spectral/ipa/rulesets/IPA-107.yaml +++ b/tools/spectral/ipa/rulesets/IPA-107.yaml @@ -129,7 +129,7 @@ rules: - `methodName`: The verb to be used in the OperationIds - `ignoreSingularizationList`: 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 + severity: error given: '#UpdateOperationObject' then: function: 'IPA107ValidOperationID' diff --git a/tools/spectral/ipa/rulesets/IPA-108.yaml b/tools/spectral/ipa/rulesets/IPA-108.yaml index 971194da6f..94538a0345 100644 --- a/tools/spectral/ipa/rulesets/IPA-108.yaml +++ b/tools/spectral/ipa/rulesets/IPA-108.yaml @@ -69,7 +69,7 @@ rules: - `methodName`: The verb to be used in the OperationIds - `ignoreSingularizationList`: 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 + severity: error given: '#DeleteOperationObject' then: function: 'IPA108ValidOperationID' diff --git a/tools/spectral/ipa/rulesets/IPA-109.yaml b/tools/spectral/ipa/rulesets/IPA-109.yaml index e3eddcf141..bad037c52e 100644 --- a/tools/spectral/ipa/rulesets/IPA-109.yaml +++ b/tools/spectral/ipa/rulesets/IPA-109.yaml @@ -79,7 +79,7 @@ rules: This rule includes one configuration options: - `ignoreSingularizationList`: 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 + severity: error given: '#OperationObject' then: function: 'IPA109ValidOperationID' diff --git a/tools/spectral/ipa/rulesets/README.md b/tools/spectral/ipa/rulesets/README.md index 2cb7be2147..ee51880aae 100644 --- a/tools/spectral/ipa/rulesets/README.md +++ b/tools/spectral/ipa/rulesets/README.md @@ -145,7 +145,7 @@ Rule checks for the following conditions: #### xgen-IPA-104-valid-operation-id - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Operation ID must start with the verb “get” and should be followed by a noun or compound noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form. If the resource is a singleton resource, the last noun may be the plural form of the collection identifier. @@ -216,7 +216,7 @@ The response body of the List method should consist of the same resource object - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation #### xgen-IPA-105-valid-operation-id - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Operation ID must start with the verb “list” and should be followed by a noun or compound noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form, where the last noun is in plural form. @@ -313,7 +313,7 @@ Rule checks for the following conditions: #### xgen-IPA-106-valid-operation-id - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Operation ID must start with the verb “create” and should be followed by a noun or compound noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form. @@ -400,7 +400,7 @@ Rule checks for the following conditions: #### xgen-IPA-107-valid-operation-id - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Operation ID must start with the verb “update” and should be followed by a noun or compound noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form. If the resource is a singleton resource, the last noun may be the plural form of the collection identifier. @@ -461,7 +461,7 @@ Rule checks for the following conditions: #### xgen-IPA-108-valid-operation-id - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Operation ID must start with the verb “delete” and should be followed by a noun or compound noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form. @@ -521,7 +521,7 @@ Rule checks for the following conditions: #### xgen-IPA-109-valid-operation-id - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Operation ID must start with the custom method verb (the custom method path section delimited by the colon (:) character) and should be followed by a noun or compound noun. If the custom Operation ID has a verb + noun, the Operation ID should end with the noun. The noun(s) in the Operation ID should be the collection identifiers from the resource identifier.