Skip to content

Commit 09c354a

Browse files
Include severity in IPA rule test
1 parent 8411c91 commit 09c354a

20 files changed

+87
-86
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,37 @@ testRule('xgen-IPA-102-path-alternate-resource-name-path-param', [
4949
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
5050
message: 'API paths must alternate between resource name and path params.',
5151
path: ['paths', '/api/atlas/v2/resourceName1/resourceName2'],
52-
severity: DiagnosticSeverity.Warning,
52+
severity: DiagnosticSeverity.Error,
5353
},
5454
{
5555
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
5656
message: 'API paths must alternate between resource name and path params.',
5757
path: ['paths', '/api/atlas/v2/resourceName/{pathParam1}/{pathParam2}'],
58-
severity: DiagnosticSeverity.Warning,
58+
severity: DiagnosticSeverity.Error,
5959
},
6060
{
6161
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
6262
message: 'API paths must alternate between resource name and path params.',
6363
path: ['paths', '/api/atlas/v2/resourceName1/{pathParam1}/resourceName2/resourceName3'],
64-
severity: DiagnosticSeverity.Warning,
64+
severity: DiagnosticSeverity.Error,
6565
},
6666
{
6767
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
6868
message: 'API paths must alternate between resource name and path params.',
6969
path: ['paths', '/api/atlas/v2/resourceName1/{pathParam1}/resourceName2/{pathParam2}/{pathParam3}'],
70-
severity: DiagnosticSeverity.Warning,
70+
severity: DiagnosticSeverity.Error,
7171
},
7272
{
7373
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
7474
message: 'API paths must alternate between resource name and path params.',
7575
path: ['paths', '/api/atlas/v2/{pathParam}'],
76-
severity: DiagnosticSeverity.Warning,
76+
severity: DiagnosticSeverity.Error,
7777
},
7878
{
7979
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
8080
message: 'API paths must alternate between resource name and path params.',
8181
path: ['paths', '/api/atlas/v2/{pathParam1}/{pathParam2}'],
82-
severity: DiagnosticSeverity.Warning,
82+
severity: DiagnosticSeverity.Error,
8383
},
8484
],
8585
},
@@ -100,37 +100,37 @@ testRule('xgen-IPA-102-path-alternate-resource-name-path-param', [
100100
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
101101
message: 'API paths must alternate between resource name and path params.',
102102
path: ['paths', '/api/atlas/v2/unauth/resourceName1/resourceName2'],
103-
severity: DiagnosticSeverity.Warning,
103+
severity: DiagnosticSeverity.Error,
104104
},
105105
{
106106
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
107107
message: 'API paths must alternate between resource name and path params.',
108108
path: ['paths', '/api/atlas/v2/unauth/resourceName/{pathParam1}/{pathParam2}'],
109-
severity: DiagnosticSeverity.Warning,
109+
severity: DiagnosticSeverity.Error,
110110
},
111111
{
112112
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
113113
message: 'API paths must alternate between resource name and path params.',
114114
path: ['paths', '/api/atlas/v2/unauth/resourceName1/{pathParam1}/resourceName2/resourceName3'],
115-
severity: DiagnosticSeverity.Warning,
115+
severity: DiagnosticSeverity.Error,
116116
},
117117
{
118118
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
119119
message: 'API paths must alternate between resource name and path params.',
120120
path: ['paths', '/api/atlas/v2/unauth/resourceName1/{pathParam1}/resourceName2/{pathParam2}/{pathParam3}'],
121-
severity: DiagnosticSeverity.Warning,
121+
severity: DiagnosticSeverity.Error,
122122
},
123123
{
124124
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
125125
message: 'API paths must alternate between resource name and path params.',
126126
path: ['paths', '/api/atlas/v2/unauth/{pathParam}'],
127-
severity: DiagnosticSeverity.Warning,
127+
severity: DiagnosticSeverity.Error,
128128
},
129129
{
130130
code: 'xgen-IPA-102-path-alternate-resource-name-path-param',
131131
message: 'API paths must alternate between resource name and path params.',
132132
path: ['paths', '/api/atlas/v2/unauth/{pathParam1}/{pathParam2}'],
133-
severity: DiagnosticSeverity.Warning,
133+
severity: DiagnosticSeverity.Error,
134134
},
135135
],
136136
},

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,31 @@ testRule('xgen-IPA-104-resource-has-GET', [
9494
code: 'xgen-IPA-104-resource-has-GET',
9595
message: 'APIs must provide a get method for resources.',
9696
path: ['paths', '/standard'],
97-
severity: DiagnosticSeverity.Warning,
97+
severity: DiagnosticSeverity.Error,
9898
},
9999
{
100100
code: 'xgen-IPA-104-resource-has-GET',
101101
message: 'APIs must provide a get method for resources.',
102102
path: ['paths', '/standard/{exampleId}/nested'],
103-
severity: DiagnosticSeverity.Warning,
103+
severity: DiagnosticSeverity.Error,
104104
},
105105
{
106106
code: 'xgen-IPA-104-resource-has-GET',
107107
message: 'APIs must provide a get method for resources.',
108108
path: ['paths', '/standard/{exampleId}/nestedSingleton'],
109-
severity: DiagnosticSeverity.Warning,
109+
severity: DiagnosticSeverity.Error,
110110
},
111111
{
112112
code: 'xgen-IPA-104-resource-has-GET',
113113
message: 'APIs must provide a get method for resources.',
114114
path: ['paths', '/custom'],
115-
severity: DiagnosticSeverity.Warning,
115+
severity: DiagnosticSeverity.Error,
116116
},
117117
{
118118
code: 'xgen-IPA-104-resource-has-GET',
119119
message: 'APIs must provide a get method for resources.',
120120
path: ['paths', '/standardWithoutSubResource'],
121-
severity: DiagnosticSeverity.Warning,
121+
severity: DiagnosticSeverity.Error,
122122
},
123123
],
124124
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ testRule('xgen-IPA-104-get-method-no-request-body', [
6363
code: 'xgen-IPA-104-get-method-no-request-body',
6464
message: 'The Get method must not include a request body.',
6565
path: ['paths', '/resource/{id}', 'get'],
66-
severity: DiagnosticSeverity.Warning,
66+
severity: DiagnosticSeverity.Error,
6767
},
6868
{
6969
code: 'xgen-IPA-104-get-method-no-request-body',
7070
message: 'The Get method must not include a request body.',
7171
path: ['paths', '/resource/{id}/singleton', 'get'],
72-
severity: DiagnosticSeverity.Warning,
72+
severity: DiagnosticSeverity.Error,
7373
},
7474
],
7575
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ testRule('xgen-IPA-104-get-method-response-has-no-input-fields', [
141141
'content',
142142
'application/vnd.atlas.2024-08-05+json',
143143
],
144-
severity: DiagnosticSeverity.Warning,
144+
severity: DiagnosticSeverity.Error,
145145
},
146146
{
147147
code: 'xgen-IPA-104-get-method-response-has-no-input-fields',
@@ -156,7 +156,7 @@ testRule('xgen-IPA-104-get-method-response-has-no-input-fields', [
156156
'content',
157157
'application/vnd.atlas.2024-08-05+json',
158158
],
159-
severity: DiagnosticSeverity.Warning,
159+
severity: DiagnosticSeverity.Error,
160160
},
161161
],
162162
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ testRule('xgen-IPA-104-get-method-returns-response-suffixed-object', [
162162
'content',
163163
'application/vnd.atlas.2023-01-01+json',
164164
],
165-
severity: DiagnosticSeverity.Warning,
165+
severity: DiagnosticSeverity.Error,
166166
},
167167
{
168168
code: 'xgen-IPA-104-get-method-returns-response-suffixed-object',
@@ -176,7 +176,7 @@ testRule('xgen-IPA-104-get-method-returns-response-suffixed-object', [
176176
'content',
177177
'application/vnd.atlas.2024-01-01+json',
178178
],
179-
severity: DiagnosticSeverity.Warning,
179+
severity: DiagnosticSeverity.Error,
180180
},
181181
{
182182
code: 'xgen-IPA-104-get-method-returns-response-suffixed-object',
@@ -190,7 +190,7 @@ testRule('xgen-IPA-104-get-method-returns-response-suffixed-object', [
190190
'content',
191191
'application/vnd.atlas.2025-01-01+json',
192192
],
193-
severity: DiagnosticSeverity.Warning,
193+
severity: DiagnosticSeverity.Error,
194194
},
195195
{
196196
code: 'xgen-IPA-104-get-method-returns-response-suffixed-object',
@@ -204,7 +204,7 @@ testRule('xgen-IPA-104-get-method-returns-response-suffixed-object', [
204204
'content',
205205
'application/vnd.atlas.2024-08-05+json',
206206
],
207-
severity: DiagnosticSeverity.Warning,
207+
severity: DiagnosticSeverity.Error,
208208
},
209209
],
210210
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
174174
'content',
175175
'application/vnd.atlas.2024-08-05+json',
176176
],
177-
severity: DiagnosticSeverity.Warning,
177+
severity: DiagnosticSeverity.Error,
178178
},
179179
{
180180
code: 'xgen-IPA-104-get-method-returns-single-resource',
@@ -189,7 +189,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
189189
'content',
190190
'application/vnd.atlas.2024-08-05+json',
191191
],
192-
severity: DiagnosticSeverity.Warning,
192+
severity: DiagnosticSeverity.Error,
193193
},
194194
{
195195
code: 'xgen-IPA-104-get-method-returns-single-resource',
@@ -204,7 +204,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
204204
'content',
205205
'application/vnd.atlas.2024-08-05+json',
206206
],
207-
severity: DiagnosticSeverity.Warning,
207+
severity: DiagnosticSeverity.Error,
208208
},
209209
{
210210
code: 'xgen-IPA-104-get-method-returns-single-resource',
@@ -219,7 +219,7 @@ testRule('xgen-IPA-104-get-method-returns-single-resource', [
219219
'content',
220220
'application/vnd.atlas.2024-08-05+json',
221221
],
222-
severity: DiagnosticSeverity.Warning,
222+
severity: DiagnosticSeverity.Error,
223223
},
224224
],
225225
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,28 +95,28 @@ testRule('xgen-IPA-104-get-method-response-code-is-200', [
9595
message:
9696
'The Get method must return a 200 OK response. This method either lacks a 200 OK response or defines a different 2xx status code.',
9797
path: ['paths', '/resourceOne/{id}', 'get'],
98-
severity: DiagnosticSeverity.Warning,
98+
severity: DiagnosticSeverity.Error,
9999
},
100100
{
101101
code: 'xgen-IPA-104-get-method-response-code-is-200',
102102
message:
103103
'The Get method must return a 200 OK response. This method either lacks a 200 OK response or defines a different 2xx status code.',
104104
path: ['paths', '/resourceTwo/{id}', 'get'],
105-
severity: DiagnosticSeverity.Warning,
105+
severity: DiagnosticSeverity.Error,
106106
},
107107
{
108108
code: 'xgen-IPA-104-get-method-response-code-is-200',
109109
message:
110110
'The Get method must return a 200 OK response. This method either lacks a 200 OK response or defines a different 2xx status code.',
111111
path: ['paths', '/resourceThree/{id}', 'get'],
112-
severity: DiagnosticSeverity.Warning,
112+
severity: DiagnosticSeverity.Error,
113113
},
114114
{
115115
code: 'xgen-IPA-104-get-method-response-code-is-200',
116116
message:
117117
'The Get method must return a 200 OK response. This method either lacks a 200 OK response or defines a different 2xx status code.',
118118
path: ['paths', '/resource/{id}/singleton', 'get'],
119-
severity: DiagnosticSeverity.Warning,
119+
severity: DiagnosticSeverity.Error,
120120
},
121121
],
122122
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ testRule('xgen-IPA-105-resource-has-list', [
5555
code: 'xgen-IPA-105-resource-has-list',
5656
message: 'APIs must provide a List method for resources.',
5757
path: ['paths', '/standard'],
58-
severity: DiagnosticSeverity.Warning,
58+
severity: DiagnosticSeverity.Error,
5959
},
6060
{
6161
code: 'xgen-IPA-105-resource-has-list',
6262
message: 'APIs must provide a List method for resources.',
6363
path: ['paths', '/standard/{exampleId}/nested'],
64-
severity: DiagnosticSeverity.Warning,
64+
severity: DiagnosticSeverity.Error,
6565
},
6666
],
6767
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ testRule('xgen-IPA-105-list-method-no-request-body', [
8585
code: 'xgen-IPA-105-list-method-no-request-body',
8686
message: 'The List method must not include a request body.',
8787
path: ['paths', '/resource', 'get'],
88-
severity: DiagnosticSeverity.Warning,
88+
severity: DiagnosticSeverity.Error,
8989
},
9090
],
9191
},

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ testRule('xgen-IPA-105-list-method-response-is-get-method-response', [
400400
message:
401401
'The schema of each result in the List method response must be the same schema as the response of the Get method.',
402402
path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'application/vnd.atlas.2024-08-05+json'],
403-
severity: DiagnosticSeverity.Warning,
403+
severity: DiagnosticSeverity.Error,
404404
},
405405
{
406406
code: 'xgen-IPA-105-list-method-response-is-get-method-response',
@@ -415,14 +415,14 @@ testRule('xgen-IPA-105-list-method-response-is-get-method-response', [
415415
'content',
416416
'application/vnd.atlas.2024-08-05+json',
417417
],
418-
severity: DiagnosticSeverity.Warning,
418+
severity: DiagnosticSeverity.Error,
419419
},
420420
{
421421
code: 'xgen-IPA-105-list-method-response-is-get-method-response',
422422
message:
423423
'Could not validate that the List method returns the same resource object as the Get method. The Get method does not have a schema.',
424424
path: ['paths', '/resourceTwo', 'get', 'responses', '200', 'content', 'application/vnd.atlas.2024-01-05+json'],
425-
severity: DiagnosticSeverity.Warning,
425+
severity: DiagnosticSeverity.Error,
426426
},
427427
{
428428
code: 'xgen-IPA-105-list-method-response-is-get-method-response',
@@ -437,7 +437,7 @@ testRule('xgen-IPA-105-list-method-response-is-get-method-response', [
437437
'content',
438438
'application/vnd.atlas.2024-01-05+json',
439439
],
440-
severity: DiagnosticSeverity.Warning,
440+
severity: DiagnosticSeverity.Error,
441441
},
442442
],
443443
},
@@ -484,7 +484,7 @@ testRule('xgen-IPA-105-list-method-response-is-get-method-response', [
484484
message:
485485
'The schema of each result in the List method response must be the same schema as the response of the Get method.',
486486
path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'application/vnd.atlas.2024-08-05+json'],
487-
severity: DiagnosticSeverity.Warning,
487+
severity: DiagnosticSeverity.Error,
488488
},
489489
],
490490
},

0 commit comments

Comments
 (0)