Skip to content

Commit 7e52ed0

Browse files
CLOUDP-311390: Fifth (Last) Rollout for IPA validations (#679)
1 parent b5b11d2 commit 7e52ed0

23 files changed

+106
-93
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [
5353
code: 'xgen-IPA-114-api-error-has-bad-request-detail',
5454
message: 'ApiError schema must have badRequestDetail field.',
5555
path: ['components', 'schemas', 'ApiError'],
56-
severity: DiagnosticSeverity.Warning,
56+
severity: DiagnosticSeverity.Error,
5757
},
5858
],
5959
},
@@ -75,7 +75,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [
7575
code: 'xgen-IPA-114-api-error-has-bad-request-detail',
7676
message: 'ApiError schema must have badRequestDetail field.',
7777
path: ['components', 'schemas', 'ApiError'],
78-
severity: DiagnosticSeverity.Warning,
78+
severity: DiagnosticSeverity.Error,
7979
},
8080
],
8181
},
@@ -101,7 +101,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [
101101
code: 'xgen-IPA-114-api-error-has-bad-request-detail',
102102
message: 'badRequestDetail must include an array of fields.',
103103
path: ['components', 'schemas', 'ApiError'],
104-
severity: DiagnosticSeverity.Warning,
104+
severity: DiagnosticSeverity.Error,
105105
},
106106
],
107107
},
@@ -129,7 +129,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [
129129
code: 'xgen-IPA-114-api-error-has-bad-request-detail',
130130
message: 'badRequestDetail must include an array of fields.',
131131
path: ['components', 'schemas', 'ApiError'],
132-
severity: DiagnosticSeverity.Warning,
132+
severity: DiagnosticSeverity.Error,
133133
},
134134
],
135135
},
@@ -161,7 +161,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [
161161
code: 'xgen-IPA-114-api-error-has-bad-request-detail',
162162
message: 'Each field must include description and field properties.',
163163
path: ['components', 'schemas', 'ApiError'],
164-
severity: DiagnosticSeverity.Warning,
164+
severity: DiagnosticSeverity.Error,
165165
},
166166
],
167167
},

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [
3737
code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors',
3838
message: 'Authenticated endpoint must define a 401 response.',
3939
path: ['paths', '/resources', 'get'],
40-
severity: DiagnosticSeverity.Warning,
40+
severity: DiagnosticSeverity.Error,
4141
},
4242
{
4343
code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors',
4444
message: 'Authenticated endpoint must define a 403 response.',
4545
path: ['paths', '/resources', 'get'],
46-
severity: DiagnosticSeverity.Warning,
46+
severity: DiagnosticSeverity.Error,
4747
},
4848
],
4949
},
@@ -66,7 +66,7 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [
6666
code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors',
6767
message: 'Authenticated endpoint must define a 401 response.',
6868
path: ['paths', '/resources', 'get'],
69-
severity: DiagnosticSeverity.Warning,
69+
severity: DiagnosticSeverity.Error,
7070
},
7171
],
7272
},
@@ -89,7 +89,7 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [
8989
code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors',
9090
message: 'Authenticated endpoint must define a 403 response.',
9191
path: ['paths', '/resources', 'get'],
92-
severity: DiagnosticSeverity.Warning,
92+
severity: DiagnosticSeverity.Error,
9393
},
9494
],
9595
},
@@ -154,7 +154,7 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [
154154
code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors',
155155
message: 'Authenticated endpoint must define a 401 and 403 responses.',
156156
path: ['paths', '/resources', 'get'],
157-
severity: DiagnosticSeverity.Warning,
157+
severity: DiagnosticSeverity.Error,
158158
},
159159
],
160160
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [
9393
code: 'xgen-IPA-114-error-responses-refer-to-api-error',
9494
message: '400 response must define a schema referencing ApiError.',
9595
path: ['paths', '/resources', 'get', 'responses', '400', 'content', 'application/json'],
96-
severity: DiagnosticSeverity.Warning,
96+
severity: DiagnosticSeverity.Error,
9797
},
9898
],
9999
},
@@ -115,7 +115,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [
115115
code: 'xgen-IPA-114-error-responses-refer-to-api-error',
116116
message: '400 response must define content with ApiError schema reference.',
117117
path: ['paths', '/resources', 'get', 'responses', '400'],
118-
severity: DiagnosticSeverity.Warning,
118+
severity: DiagnosticSeverity.Error,
119119
},
120120
],
121121
},
@@ -157,7 +157,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [
157157
code: 'xgen-IPA-114-error-responses-refer-to-api-error',
158158
message: '500 response must reference ApiError schema.',
159159
path: ['paths', '/resources', 'get', 'responses', '500', 'content', 'application/json'],
160-
severity: DiagnosticSeverity.Warning,
160+
severity: DiagnosticSeverity.Error,
161161
},
162162
],
163163
},
@@ -192,7 +192,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [
192192
code: 'xgen-IPA-114-error-responses-refer-to-api-error',
193193
message: '404 response must reference ApiError schema.',
194194
path: ['paths', '/resources', 'get', 'responses', '404', 'content', 'application/json'],
195-
severity: DiagnosticSeverity.Warning,
195+
severity: DiagnosticSeverity.Error,
196196
},
197197
],
198198
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ testRule('xgen-IPA-114-parameterized-paths-have-404-not-found', [
3636
code: 'xgen-IPA-114-parameterized-paths-have-404-not-found',
3737
message: 'Parameterized path must define a 404 response.',
3838
path: ['paths', '/resources/{resourceId}', 'get'],
39-
severity: DiagnosticSeverity.Warning,
39+
severity: DiagnosticSeverity.Error,
4040
},
4141
],
4242
},
@@ -85,7 +85,7 @@ testRule('xgen-IPA-114-parameterized-paths-have-404-not-found', [
8585
code: 'xgen-IPA-114-parameterized-paths-have-404-not-found',
8686
message: 'Parameterized path must define a 404 response.',
8787
path: ['paths', '/resources/{resourceId}', 'get'],
88-
severity: DiagnosticSeverity.Warning,
88+
severity: DiagnosticSeverity.Error,
8989
},
9090
],
9191
},

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [
173173
'content',
174174
'application/vnd.atlas.2024-08-05+json',
175175
],
176-
severity: DiagnosticSeverity.Warning,
176+
severity: DiagnosticSeverity.Error,
177177
},
178178
{
179179
code: 'xgen-IPA-117-objects-must-be-well-defined',
@@ -190,7 +190,7 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [
190190
'properties',
191191
'name',
192192
],
193-
severity: DiagnosticSeverity.Warning,
193+
severity: DiagnosticSeverity.Error,
194194
},
195195
{
196196
code: 'xgen-IPA-117-objects-must-be-well-defined',
@@ -208,42 +208,42 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [
208208
'hobbies',
209209
'items',
210210
],
211-
severity: DiagnosticSeverity.Warning,
211+
severity: DiagnosticSeverity.Error,
212212
},
213213
{
214214
code: 'xgen-IPA-117-objects-must-be-well-defined',
215215
message:
216216
'Components of type "object" must be well-defined with for example a schema, example(s) or properties.',
217217
path: ['paths', '/resource/{id}', 'get', 'requestBody', 'content', 'application/vnd.atlas.2023-08-05+json'],
218-
severity: DiagnosticSeverity.Warning,
218+
severity: DiagnosticSeverity.Error,
219219
},
220220
{
221221
code: 'xgen-IPA-117-objects-must-be-well-defined',
222222
message:
223223
'Components of type "object" must be well-defined with for example a schema, example(s) or properties.',
224224
path: ['components', 'schemas', 'SchemaOneOf'],
225-
severity: DiagnosticSeverity.Warning,
225+
severity: DiagnosticSeverity.Error,
226226
},
227227
{
228228
code: 'xgen-IPA-117-objects-must-be-well-defined',
229229
message:
230230
'Components of type "object" must be well-defined with for example a schema, example(s) or properties.',
231231
path: ['components', 'schemas', 'SchemaAllOf'],
232-
severity: DiagnosticSeverity.Warning,
232+
severity: DiagnosticSeverity.Error,
233233
},
234234
{
235235
code: 'xgen-IPA-117-objects-must-be-well-defined',
236236
message:
237237
'Components of type "object" must be well-defined with for example a schema, example(s) or properties.',
238238
path: ['components', 'schemas', 'SchemaAnyOf'],
239-
severity: DiagnosticSeverity.Warning,
239+
severity: DiagnosticSeverity.Error,
240240
},
241241
{
242242
code: 'xgen-IPA-117-objects-must-be-well-defined',
243243
message:
244244
'Components of type "object" must be well-defined with for example a schema, example(s) or properties.',
245245
path: ['components', 'schemas', 'ArraySchema', 'items'],
246-
severity: DiagnosticSeverity.Warning,
246+
severity: DiagnosticSeverity.Error,
247247
},
248248
],
249249
},
@@ -279,7 +279,7 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [
279279
message:
280280
'Components of type "object" must be well-defined with for example a schema, example(s) or properties.',
281281
path: ['components', 'schemas', 'Schema'],
282-
severity: DiagnosticSeverity.Warning,
282+
severity: DiagnosticSeverity.Error,
283283
},
284284
],
285285
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ testRule('xgen-IPA-117-parameter-has-examples-or-schema', [
5454
code: 'xgen-IPA-117-parameter-has-examples-or-schema',
5555
message: 'API producers must provide a well-defined schema or example(s) for parameters.',
5656
path: ['paths', '/resource/{id}', 'get', 'parameters', '0'],
57-
severity: DiagnosticSeverity.Warning,
57+
severity: DiagnosticSeverity.Error,
5858
},
5959
{
6060
code: 'xgen-IPA-117-parameter-has-examples-or-schema',
6161
message: 'API producers must provide a well-defined schema or example(s) for parameters.',
6262
path: ['components', 'parameters', 'id'],
63-
severity: DiagnosticSeverity.Warning,
63+
severity: DiagnosticSeverity.Error,
6464
},
6565
],
6666
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ testRule('xgen-IPA-117-plaintext-response-must-have-example', [
9797
code: 'xgen-IPA-117-plaintext-response-must-have-example',
9898
message: 'For APIs that respond with plain text, for example CSV, API producers must provide an example.',
9999
path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'application/vnd.atlas.2022-01-01+csv'],
100-
severity: DiagnosticSeverity.Warning,
100+
severity: DiagnosticSeverity.Error,
101101
},
102102
{
103103
code: 'xgen-IPA-117-plaintext-response-must-have-example',
104104
message: 'For APIs that respond with plain text, for example CSV, API producers must provide an example.',
105105
path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'application/vnd.atlas.2023-01-01+csv'],
106-
severity: DiagnosticSeverity.Warning,
106+
severity: DiagnosticSeverity.Error,
107107
},
108108
{
109109
code: 'xgen-IPA-117-plaintext-response-must-have-example',
110110
message: 'For APIs that respond with plain text, for example CSV, API producers must provide an example.',
111111
path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'text/plain'],
112-
severity: DiagnosticSeverity.Warning,
112+
severity: DiagnosticSeverity.Error,
113113
},
114114
],
115115
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ testRule('xgen-IPA-118-no-additional-properties-false', [
8282
message:
8383
"Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.",
8484
path: ['components', 'schemas', 'ExampleSchema'],
85-
severity: DiagnosticSeverity.Warning,
85+
severity: DiagnosticSeverity.Error,
8686
},
8787
],
8888
},
@@ -112,7 +112,7 @@ testRule('xgen-IPA-118-no-additional-properties-false', [
112112
message:
113113
"Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.",
114114
path: ['components', 'schemas', 'ParentSchema', 'properties', 'child'],
115-
severity: DiagnosticSeverity.Warning,
115+
severity: DiagnosticSeverity.Error,
116116
},
117117
],
118118
},
@@ -143,14 +143,14 @@ testRule('xgen-IPA-118-no-additional-properties-false', [
143143
message:
144144
"Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.",
145145
path: ['components', 'schemas', 'ParentSchema'],
146-
severity: DiagnosticSeverity.Warning,
146+
severity: DiagnosticSeverity.Error,
147147
},
148148
{
149149
code: 'xgen-IPA-118-no-additional-properties-false',
150150
message:
151151
"Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.",
152152
path: ['components', 'schemas', 'ParentSchema', 'properties', 'child'],
153-
severity: DiagnosticSeverity.Warning,
153+
severity: DiagnosticSeverity.Error,
154154
},
155155
],
156156
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ testRule('xgen-IPA-119-no-default-for-cloud-providers', [
4242
code: 'xgen-IPA-119-no-default-for-cloud-providers',
4343
message: 'When using a provider field or param, API producers should not define a default value.',
4444
path: ['components', 'schemas', 'Schema', 'properties', 'cloudProvider'],
45-
severity: DiagnosticSeverity.Warning,
45+
severity: DiagnosticSeverity.Error,
4646
},
4747
],
4848
},
@@ -68,7 +68,7 @@ testRule('xgen-IPA-119-no-default-for-cloud-providers', [
6868
code: 'xgen-IPA-119-no-default-for-cloud-providers',
6969
message: 'When using a provider field or param, API producers should not define a default value.',
7070
path: ['components', 'schemas', 'Schema', 'properties', 'provider'],
71-
severity: DiagnosticSeverity.Warning,
71+
severity: DiagnosticSeverity.Error,
7272
},
7373
],
7474
},
@@ -137,7 +137,7 @@ testRule('xgen-IPA-119-no-default-for-cloud-providers', [
137137
code: 'xgen-IPA-119-no-default-for-cloud-providers',
138138
message: 'When using a provider field or param, API producers should not define a default value.',
139139
path: ['paths', '/resources', 'get', 'parameters', '0'],
140-
severity: DiagnosticSeverity.Warning,
140+
severity: DiagnosticSeverity.Error,
141141
},
142142
],
143143
},

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,21 @@ testRule('xgen-IPA-121-date-time-fields-mention-iso-8601', [
114114
message:
115115
'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.',
116116
path: ['components', 'schemas', 'TestSchema', 'properties', 'createdAt'],
117-
severity: DiagnosticSeverity.Warning,
117+
severity: DiagnosticSeverity.Error,
118118
},
119119
{
120120
code: 'xgen-IPA-121-date-time-fields-mention-iso-8601',
121121
message:
122122
'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.',
123123
path: ['components', 'schemas', 'TestSchema', 'properties', 'modifiedAt'],
124-
severity: DiagnosticSeverity.Warning,
124+
severity: DiagnosticSeverity.Error,
125125
},
126126
{
127127
code: 'xgen-IPA-121-date-time-fields-mention-iso-8601',
128128
message:
129129
'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.',
130130
path: ['components', 'parameters', 'TestParameter'],
131-
severity: DiagnosticSeverity.Warning,
131+
severity: DiagnosticSeverity.Error,
132132
},
133133
],
134134
},
@@ -204,7 +204,7 @@ testRule('xgen-IPA-121-date-time-fields-mention-iso-8601', [
204204
message:
205205
'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.',
206206
path: ['paths', '/resources', 'get', 'parameters', '1'],
207-
severity: DiagnosticSeverity.Warning,
207+
severity: DiagnosticSeverity.Error,
208208
},
209209
],
210210
},
@@ -254,7 +254,7 @@ testRule('xgen-IPA-121-date-time-fields-mention-iso-8601', [
254254
'properties',
255255
'expiresAt',
256256
],
257-
severity: DiagnosticSeverity.Warning,
257+
severity: DiagnosticSeverity.Error,
258258
},
259259
],
260260
},

0 commit comments

Comments
 (0)