Skip to content

Commit d80ae56

Browse files
Merge branch 'main' into CLOUDP-304940
2 parents c1edb03 + 25e15ea commit d80ae56

40 files changed

+200
-220
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,25 @@ testRule('xgen-IPA-005-exception-extension-format', [
5151
errors: [
5252
{
5353
code: 'xgen-IPA-005-exception-extension-format',
54-
message: 'IPA exceptions must have a valid rule name and a reason. http://go/ipa-spectral#IPA-102',
54+
message: 'IPA exceptions must have a valid rule name and a reason.',
5555
path: ['paths', '/path1', 'x-xgen-IPA-exception'],
5656
severity: DiagnosticSeverity.Warning,
5757
},
5858
{
5959
code: 'xgen-IPA-005-exception-extension-format',
60-
message: 'IPA exceptions must have a valid rule name and a reason. http://go/ipa-spectral#IPA-102',
60+
message: 'IPA exceptions must have a valid rule name and a reason.',
6161
path: ['paths', '/path2', 'x-xgen-IPA-exception', 'xgen-IPA-100-rule-name'],
6262
severity: DiagnosticSeverity.Warning,
6363
},
6464
{
6565
code: 'xgen-IPA-005-exception-extension-format',
66-
message: 'IPA exceptions must have a valid rule name and a reason. http://go/ipa-spectral#IPA-102',
66+
message: 'IPA exceptions must have a valid rule name and a reason.',
6767
path: ['paths', '/path3', 'x-xgen-IPA-exception', 'invalid-rule-name'],
6868
severity: DiagnosticSeverity.Warning,
6969
},
7070
{
7171
code: 'xgen-IPA-005-exception-extension-format',
72-
message: 'IPA exceptions must have a valid rule name and a reason. http://go/ipa-spectral#IPA-102',
72+
message: 'IPA exceptions must have a valid rule name and a reason.',
7373
path: ['paths', '/path4', 'x-xgen-IPA-exception', 'xgen-IPA-100-rule-name'],
7474
severity: DiagnosticSeverity.Warning,
7575
},

tools/spectral/ipa/__tests__/__helpers__/testRule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default (ruleName, tests) => {
1717

1818
errors.forEach((error, index) => {
1919
expect(error.code).toEqual(testCase.errors[index].code);
20-
expect(error.message).toEqual(testCase.errors[index].message);
20+
expect(error.message).toMatch(testCase.errors[index].message);
2121
expect(error.path).toEqual(testCase.errors[index].path);
2222
});
2323
});

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
4545
{
4646
code: 'xgen-IPA-102-collection-identifier-camelCase',
4747
message:
48-
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources' is not in camelCase. http://go/ipa-spectral#IPA-102",
48+
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources' is not in camelCase.",
4949
path: ['paths', '/Resources'],
5050
severity: DiagnosticSeverity.Warning,
5151
},
@@ -62,7 +62,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
6262
{
6363
code: 'xgen-IPA-102-collection-identifier-camelCase',
6464
message:
65-
"Collection identifiers must be in camelCase. Path segment 'resource_groups' in path '/resource_groups' is not in camelCase. http://go/ipa-spectral#IPA-102",
65+
"Collection identifiers must be in camelCase. Path segment 'resource_groups' in path '/resource_groups' is not in camelCase.",
6666
path: ['paths', '/resource_groups'],
6767
severity: DiagnosticSeverity.Warning,
6868
},
@@ -79,7 +79,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
7979
{
8080
code: 'xgen-IPA-102-collection-identifier-camelCase',
8181
message:
82-
"Collection identifiers must be in camelCase. Path segment 'resource-groups' in path '/resource-groups' is not in camelCase. http://go/ipa-spectral#IPA-102",
82+
"Collection identifiers must be in camelCase. Path segment 'resource-groups' in path '/resource-groups' is not in camelCase.",
8383
path: ['paths', '/resource-groups'],
8484
severity: DiagnosticSeverity.Warning,
8585
},
@@ -96,7 +96,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
9696
{
9797
code: 'xgen-IPA-102-collection-identifier-camelCase',
9898
message:
99-
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources:createResource' is not in camelCase. http://go/ipa-spectral#IPA-102",
99+
"Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources:createResource' is not in camelCase.",
100100
path: ['paths', '/Resources:createResource'],
101101
severity: DiagnosticSeverity.Warning,
102102
},
@@ -113,7 +113,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
113113
{
114114
code: 'xgen-IPA-102-collection-identifier-camelCase',
115115
message:
116-
"Collection identifiers must be in camelCase. Path segment 'resourcesAPI' in path '/resourcesAPI' is not in camelCase. http://go/ipa-spectral#IPA-102",
116+
"Collection identifiers must be in camelCase. Path segment 'resourcesAPI' in path '/resourcesAPI' is not in camelCase.",
117117
path: ['paths', '/resourcesAPI'],
118118
severity: DiagnosticSeverity.Warning,
119119
},
@@ -145,21 +145,21 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
145145
{
146146
code: 'xgen-IPA-102-collection-identifier-camelCase',
147147
message:
148-
"Collection identifiers must be in camelCase. Path '/api//users' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
148+
"Collection identifiers must be in camelCase. Path '/api//users' contains double slashes (//) which is not allowed.",
149149
path: ['paths', '/api//users'],
150150
severity: DiagnosticSeverity.Warning,
151151
},
152152
{
153153
code: 'xgen-IPA-102-collection-identifier-camelCase',
154154
message:
155-
"Collection identifiers must be in camelCase. Path '/resources///{resourceId}' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
155+
"Collection identifiers must be in camelCase. Path '/resources///{resourceId}' contains double slashes (//) which is not allowed.",
156156
path: ['paths', '/resources///{resourceId}'],
157157
severity: DiagnosticSeverity.Warning,
158158
},
159159
{
160160
code: 'xgen-IPA-102-collection-identifier-camelCase',
161161
message:
162-
"Collection identifiers must be in camelCase. Path '//doubleSlashAtStart' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
162+
"Collection identifiers must be in camelCase. Path '//doubleSlashAtStart' contains double slashes (//) which is not allowed.",
163163
path: ['paths', '//doubleSlashAtStart'],
164164
severity: DiagnosticSeverity.Warning,
165165
},
@@ -186,21 +186,21 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
186186
{
187187
code: 'xgen-IPA-102-collection-identifier-camelCase',
188188
message:
189-
"Collection identifiers must be in camelCase. Path segment 'API' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa-spectral#IPA-102",
189+
"Collection identifiers must be in camelCase. Path segment 'API' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase.",
190190
path: ['paths', '/API/Resource_groups/{userId}/User-profiles'],
191191
severity: DiagnosticSeverity.Warning,
192192
},
193193
{
194194
code: 'xgen-IPA-102-collection-identifier-camelCase',
195195
message:
196-
"Collection identifiers must be in camelCase. Path segment 'Resource_groups' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa-spectral#IPA-102",
196+
"Collection identifiers must be in camelCase. Path segment 'Resource_groups' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase.",
197197
path: ['paths', '/API/Resource_groups/{userId}/User-profiles'],
198198
severity: DiagnosticSeverity.Warning,
199199
},
200200
{
201201
code: 'xgen-IPA-102-collection-identifier-camelCase',
202202
message:
203-
"Collection identifiers must be in camelCase. Path segment 'User-profiles' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase. http://go/ipa-spectral#IPA-102",
203+
"Collection identifiers must be in camelCase. Path segment 'User-profiles' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase.",
204204
path: ['paths', '/API/Resource_groups/{userId}/User-profiles'],
205205
severity: DiagnosticSeverity.Warning,
206206
},
@@ -217,14 +217,14 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
217217
{
218218
code: 'xgen-IPA-102-collection-identifier-camelCase',
219219
message:
220-
"Collection identifiers must be in camelCase. Path segment 'Valid' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase. http://go/ipa-spectral#IPA-102",
220+
"Collection identifiers must be in camelCase. Path segment 'Valid' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase.",
221221
path: ['paths', '/api/Valid/Invalid_resource/{id}:validCustomMethod'],
222222
severity: DiagnosticSeverity.Warning,
223223
},
224224
{
225225
code: 'xgen-IPA-102-collection-identifier-camelCase',
226226
message:
227-
"Collection identifiers must be in camelCase. Path segment 'Invalid_resource' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase. http://go/ipa-spectral#IPA-102",
227+
"Collection identifiers must be in camelCase. Path segment 'Invalid_resource' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase.",
228228
path: ['paths', '/api/Valid/Invalid_resource/{id}:validCustomMethod'],
229229
severity: DiagnosticSeverity.Warning,
230230
},
@@ -241,14 +241,14 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [
241241
{
242242
code: 'xgen-IPA-102-collection-identifier-camelCase',
243243
message:
244-
"Collection identifiers must be in camelCase. Path '/api//Invalid_segment//resources' contains double slashes (//) which is not allowed. http://go/ipa-spectral#IPA-102",
244+
"Collection identifiers must be in camelCase. Path '/api//Invalid_segment//resources' contains double slashes (//) which is not allowed.",
245245
path: ['paths', '/api//Invalid_segment//resources'],
246246
severity: DiagnosticSeverity.Warning,
247247
},
248248
{
249249
code: 'xgen-IPA-102-collection-identifier-camelCase',
250250
message:
251-
"Collection identifiers must be in camelCase. Path segment 'Invalid_segment' in path '/api//Invalid_segment//resources' is not in camelCase. http://go/ipa-spectral#IPA-102",
251+
"Collection identifiers must be in camelCase. Path segment 'Invalid_segment' in path '/api//Invalid_segment//resources' is not in camelCase.",
252252
path: ['paths', '/api//Invalid_segment//resources'],
253253
severity: DiagnosticSeverity.Warning,
254254
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ testRule('xgen-IPA-102-collection-identifier-pattern', [
4545
{
4646
code: 'xgen-IPA-102-collection-identifier-pattern',
4747
message:
48-
"Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers (/[a-z][a-zA-Z0-9]*/). Path segment 'Resources' in path '/Resources' doesn't match the required pattern. http://go/ipa/102",
48+
"Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers (/[a-z][a-zA-Z0-9]*/). Path segment 'Resources' in path '/Resources' doesn't match the required pattern.",
4949
path: ['paths', '/Resources'],
5050
severity: DiagnosticSeverity.Warning,
5151
},
@@ -63,14 +63,14 @@ testRule('xgen-IPA-102-collection-identifier-pattern', [
6363
{
6464
code: 'xgen-IPA-102-collection-identifier-pattern',
6565
message:
66-
"Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers (/[a-z][a-zA-Z0-9]*/). Path segment 'resource-groups' in path '/resource-groups' doesn't match the required pattern. http://go/ipa/102",
66+
"Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers (/[a-z][a-zA-Z0-9]*/). Path segment 'resource-groups' in path '/resource-groups' doesn't match the required pattern.",
6767
path: ['paths', '/resource-groups'],
6868
severity: DiagnosticSeverity.Warning,
6969
},
7070
{
7171
code: 'xgen-IPA-102-collection-identifier-pattern',
7272
message:
73-
"Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers (/[a-z][a-zA-Z0-9]*/). Path segment 'user_profiles' in path '/user_profiles' doesn't match the required pattern. http://go/ipa/102",
73+
"Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers (/[a-z][a-zA-Z0-9]*/). Path segment 'user_profiles' in path '/user_profiles' doesn't match the required pattern.",
7474
path: ['paths', '/user_profiles'],
7575
severity: DiagnosticSeverity.Warning,
7676
},

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

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -392,57 +392,50 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
392392
errors: [
393393
{
394394
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
395-
message:
396-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
395+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
397396
path: ['paths', '/resource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
398397
severity: DiagnosticSeverity.Warning,
399398
},
400399
{
401400
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
402-
message:
403-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
401+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
404402
path: ['paths', '/resource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
405403
severity: DiagnosticSeverity.Warning,
406404
},
407405
{
408406
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
409-
message:
410-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
407+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
411408
path: ['paths', '/resourceTwo', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
412409
severity: DiagnosticSeverity.Warning,
413410
},
414411
{
415412
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
416-
message:
417-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
413+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
418414
path: ['paths', '/resourceTwo', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
419415
severity: DiagnosticSeverity.Warning,
420416
},
421417
{
422418
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
423-
message:
424-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
419+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
425420
path: ['paths', '/resourceThree', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
426421
severity: DiagnosticSeverity.Warning,
427422
},
428423
{
429424
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
430425
message:
431-
'Could not validate that the Create request body schema matches the response schema of the Get method. The Get method does not have a schema. http://go/ipa-spectral#IPA-106',
426+
'Could not validate that the Create request body schema matches the response schema of the Get method. The Get method does not have a schema.',
432427
path: ['paths', '/resourceFour', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
433428
severity: DiagnosticSeverity.Warning,
434429
},
435430
{
436431
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
437-
message:
438-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
432+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
439433
path: ['paths', '/resourceCircular', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
440434
severity: DiagnosticSeverity.Warning,
441435
},
442436
{
443437
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
444-
message:
445-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
438+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
446439
path: ['paths', '/resourceCircular', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
447440
severity: DiagnosticSeverity.Warning,
448441
},
@@ -491,15 +484,13 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
491484
errors: [
492485
{
493486
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
494-
message:
495-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
487+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
496488
path: ['paths', '/animalResource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
497489
severity: DiagnosticSeverity.Warning,
498490
},
499491
{
500492
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
501-
message:
502-
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa-spectral#IPA-106',
493+
message: 'The request body schema properties must match the response body schema properties of the Get method.',
503494
path: ['paths', '/animalResource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
504495
severity: DiagnosticSeverity.Warning,
505496
},

0 commit comments

Comments
 (0)