Skip to content

Commit 1bf015f

Browse files
author
Sophia Marie Terry
committed
IPA 108 tests for overrides
1 parent d5a2d5c commit 1bf015f

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

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

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,73 @@ testRule('xgen-IPA-108-valid-operation-id', [
8484
},
8585
],
8686
},
87+
{
88+
name: 'valid methods with valid overrides',
89+
document: {
90+
paths: {
91+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}': {
92+
delete: {
93+
operationId: 'deleteFederationSettingConnectedOrgConfigRoleMapping',
94+
'x-xgen-operation-id-override': 'deleteRoleMapping',
95+
},
96+
},
97+
},
98+
},
99+
errors: [],
100+
},
101+
{
102+
name: 'valid methods with invalid overrides',
103+
document: {
104+
paths: {
105+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}': {
106+
delete: {
107+
operationId: 'deleteFederationSettingConnectedOrgConfigRoleMapping',
108+
'x-xgen-operation-id-override': 'deleteMappingConfigTest',
109+
},
110+
},
111+
},
112+
},
113+
errors: [
114+
{
115+
code: 'xgen-IPA-108-valid-operation-id',
116+
message:
117+
"The operation ID override must only contain nouns from the operation ID 'deleteFederationSettingConnectedOrgConfigRoleMapping'. ",
118+
path: [
119+
'paths',
120+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}',
121+
'delete',
122+
'x-xgen-operation-id-override',
123+
],
124+
severity: DiagnosticSeverity.Warning,
125+
},
126+
{
127+
code: 'xgen-IPA-108-valid-operation-id',
128+
message: "The operation ID override must end with the noun 'Mapping'. ",
129+
path: [
130+
'paths',
131+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}',
132+
'delete',
133+
'x-xgen-operation-id-override',
134+
],
135+
severity: DiagnosticSeverity.Warning,
136+
},
137+
],
138+
},
139+
{
140+
name: 'valid method with verb overrides',
141+
document: {
142+
paths: {
143+
'/api/atlas/v2/groups/{groupId}/serverless': {
144+
delete: {
145+
operationId: 'deleteGroupServerlessInstance',
146+
'x-xgen-method-verb-override': { verb: 'deleteInstance', customMethod: false },
147+
'x-xgen-operation-id-override': 'deleteServerlessInstance',
148+
},
149+
},
150+
},
151+
},
152+
errors: [],
153+
},
87154
{
88155
name: 'invalid methods with exceptions',
89156
document: {

0 commit comments

Comments
 (0)