Skip to content

Commit 4e84ea6

Browse files
author
Sophia Marie Terry
committed
IPA 104 tests for overrides
1 parent d962ed1 commit 4e84ea6

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

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

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,72 @@ testRule('xgen-IPA-104-valid-operation-id', [
6363
},
6464
],
6565
},
66+
{
67+
name: 'valid methods with valid overrides',
68+
document: {
69+
paths: {
70+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}': {
71+
get: {
72+
operationId: 'getFederationSettingConnectedOrgConfigRoleMapping',
73+
'x-xgen-operation-id-override': 'getRoleMapping',
74+
},
75+
},
76+
},
77+
},
78+
errors: [],
79+
},
80+
{
81+
name: 'valid methods with invalid overrides',
82+
document: {
83+
paths: {
84+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}': {
85+
get: {
86+
operationId: 'getFederationSettingConnectedOrgConfigRoleMapping',
87+
'x-xgen-operation-id-override': 'getGroupRoleConfig',
88+
},
89+
},
90+
},
91+
},
92+
errors: [
93+
{
94+
code: 'xgen-IPA-104-valid-operation-id',
95+
message:
96+
"The operation ID override must only contain nouns from the operation ID 'getFederationSettingConnectedOrgConfigRoleMapping'. ",
97+
path: [
98+
'paths',
99+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}',
100+
'get',
101+
'x-xgen-operation-id-override',
102+
],
103+
severity: DiagnosticSeverity.Warning,
104+
},
105+
{
106+
code: 'xgen-IPA-104-valid-operation-id',
107+
message: "The operation ID override must end with the noun 'Mapping'. ",
108+
path: [
109+
'paths',
110+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}',
111+
'get',
112+
'x-xgen-operation-id-override',
113+
],
114+
severity: DiagnosticSeverity.Warning,
115+
},
116+
],
117+
},
118+
{
119+
name: 'valid method with verb overrides',
120+
document: {
121+
paths: {
122+
'/api/atlas/v2/groups/{groupId}/streams/{tenantName}': {
123+
get: {
124+
operationId: 'getGroupStreamWorkspace',
125+
'x-xgen-method-verb-override': { verb: 'getWorkspace', customMethod: false },
126+
},
127+
},
128+
},
129+
},
130+
errors: [],
131+
},
66132
{
67133
name: 'invalid methods with exceptions',
68134
document: {

0 commit comments

Comments
 (0)