Skip to content

Commit 87da16f

Browse files
author
Sophia Marie Terry
committed
IPA 105 tests for overrides
1 parent 4e84ea6 commit 87da16f

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,63 @@ testRule('xgen-IPA-105-valid-operation-id', [
6363
},
6464
],
6565
},
66+
{
67+
name: 'valid methods with valid overrides',
68+
document: {
69+
paths: {
70+
'/api/atlas/v2/groups/{groupId}/backup/exportBuckets': {
71+
get: {
72+
operationId: 'listGroupBackupExportBuckets',
73+
'x-xgen-operation-id-override': 'listExportBuckets',
74+
},
75+
},
76+
},
77+
},
78+
errors: [],
79+
},
80+
{
81+
name: 'valid methods with invalid overrides',
82+
document: {
83+
paths: {
84+
'/api/atlas/v2/groups/{groupId}/backup/exportBuckets': {
85+
get: {
86+
operationId: 'listGroupBackupExportBuckets',
87+
'x-xgen-operation-id-override': 'listMyExports',
88+
},
89+
},
90+
},
91+
},
92+
errors: [
93+
{
94+
code: 'xgen-IPA-105-valid-operation-id',
95+
message:
96+
"The operation ID override must only contain nouns from the operation ID 'listGroupBackupExportBuckets'. ",
97+
path: ['paths', '/api/atlas/v2/groups/{groupId}/backup/exportBuckets', 'get', 'x-xgen-operation-id-override'],
98+
severity: DiagnosticSeverity.Warning,
99+
},
100+
{
101+
code: 'xgen-IPA-105-valid-operation-id',
102+
message: "The operation ID override must end with the noun 'Buckets'. ",
103+
path: ['paths', '/api/atlas/v2/groups/{groupId}/backup/exportBuckets', 'get', 'x-xgen-operation-id-override'],
104+
severity: DiagnosticSeverity.Warning,
105+
},
106+
],
107+
},
108+
{
109+
name: 'valid method with verb overrides',
110+
document: {
111+
paths: {
112+
'/api/atlas/v2/groups/{groupId}/serverless': {
113+
get: {
114+
operationId: 'listGroupServerlessInstances',
115+
'x-xgen-method-verb-override': { verb: 'listInstances', customMethod: false },
116+
'x-xgen-operation-id-override': 'listServerlessInstances',
117+
},
118+
},
119+
},
120+
},
121+
errors: [],
122+
},
66123
{
67124
name: 'invalid methods with exceptions',
68125
document: {

0 commit comments

Comments
 (0)