Skip to content

Commit 427afd7

Browse files
author
Sophia Marie Terry
committed
IPA 104 opId tests
1 parent ea7edbb commit 427afd7

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
},
2020
"testPathIgnorePatterns": [
2121
"__helpers__",
22-
"metrics/data",
23-
"IPA\\d+ValidOperationID\\.test\\.js$"
22+
"metrics/data"
2423
]
2524
},
2625
"dependencies": {

tools/spectral/ipa/__tests__/IPA104ValidOperationID.test.js

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import testRule from './__helpers__/testRule';
2-
3-
// TODO: add tests for xgen-custom-method extension - CLOUDP-306294
4-
// TOOD: enable tests for invalid methods (after rules are upgraded to warning) - CLOUDP-329722
2+
import { DiagnosticSeverity } from '@stoplight/types';
53

64
testRule('xgen-IPA-104-valid-operation-id', [
75
{
@@ -17,40 +15,51 @@ testRule('xgen-IPA-104-valid-operation-id', [
1715
},
1816
errors: [],
1917
},
20-
// This test will be enable when the xgen-IPA-104-valid-operation-id is set to warning severity - CLOUDP-329722
21-
/* {
22-
name: 'invalid methods',
18+
{
19+
name: 'invalid methods with short opIDs',
2320
document: {
2421
paths: {
25-
'/api/atlas/v2/groups/{groupId}/accessList/{entryValue}/status': {
26-
get: {
27-
operationId: 'getProjectIpAccessListStatus',
28-
},
29-
},
30-
'/api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/limits/{limitName}': {
22+
'/api/atlas/v2/groups/{groupId}/accessList/{entryValue}': {
3123
get: {
32-
operationId: 'returnFederatedDatabaseQueryLimit',
24+
operationId: 'getProjectIpList',
3325
},
3426
},
3527
},
3628
},
3729
errors: [
3830
{
3931
code: 'xgen-IPA-104-valid-operation-id',
40-
message:
41-
'Invalid OperationID. ',
42-
path: ['paths', '/api/atlas/v2/groups/{groupId}/accessList/{entryValue}/status', 'get'],
32+
message: 'Invalid OperationID. ',
33+
path: ['paths', '/api/atlas/v2/groups/{groupId}/accessList/{entryValue}', 'get', 'operationId'],
4334
severity: DiagnosticSeverity.Warning,
4435
},
36+
],
37+
},
38+
{
39+
name: 'invalid methods with long opIDs',
40+
document: {
41+
paths: {
42+
'/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/queryShapeInsights/{queryShapeHash}/details': {
43+
get: {
44+
operationId: 'getShardedClusterBackup',
45+
},
46+
},
47+
},
48+
},
49+
errors: [
4550
{
4651
code: 'xgen-IPA-104-valid-operation-id',
47-
message:
48-
'Invalid OperationID. ',
49-
path: ['paths', '/api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/limits/{limitName}', 'get'],
52+
message: 'Invalid OperationID. ',
53+
path: [
54+
'paths',
55+
'/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/queryShapeInsights/{queryShapeHash}/details',
56+
'get',
57+
'operationId',
58+
],
5059
severity: DiagnosticSeverity.Warning,
5160
},
5261
],
53-
}, */
62+
},
5463
{
5564
name: 'invalid methods with exceptions',
5665
document: {

tools/spectral/ipa/rulesets/IPA-104.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ rules:
110110
- Generates the expected OperationId given the resource identifier
111111
- Confirms that the existing operationId is compliant with generated IPA Compliant OperationId
112112
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-104-valid-operation-id'
113-
severity: off
113+
severity: warn
114114
given: '#GetOperationObject'
115115
then:
116116
function: 'IPA104ValidOperationID'

0 commit comments

Comments
 (0)