Skip to content

Commit 4d520cc

Browse files
committed
Merge remote-tracking branch 'origin/main' into changelog-manual-entries
2 parents ad12a84 + 7449c54 commit 4d520cc

10 files changed

+1107
-54
lines changed

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

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,31 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
318318
},
319319
},
320320
},
321+
// Missing schema for Get method
322+
'/resourceFour': {
323+
post: {
324+
requestBody: {
325+
content: {
326+
'application/vnd.atlas.2023-01-01+json': {
327+
schema: {
328+
$ref: '#/components/schemas/SchemaOne',
329+
},
330+
},
331+
},
332+
},
333+
},
334+
},
335+
'/resourceFour/{id}': {
336+
get: {
337+
responses: {
338+
200: {
339+
content: {
340+
'application/vnd.atlas.2023-01-01+json': {},
341+
},
342+
},
343+
},
344+
},
345+
},
321346
'/resourceCircular': {
322347
post: {
323348
requestBody: {
@@ -361,27 +386,55 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
361386
path: ['paths', '/resource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
362387
severity: DiagnosticSeverity.Warning,
363388
},
389+
{
390+
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
391+
message:
392+
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106',
393+
path: ['paths', '/resource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
394+
severity: DiagnosticSeverity.Warning,
395+
},
364396
{
365397
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
366398
message:
367399
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106',
368400
path: ['paths', '/resourceTwo', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
369401
severity: DiagnosticSeverity.Warning,
370402
},
403+
{
404+
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
405+
message:
406+
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106',
407+
path: ['paths', '/resourceTwo', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
408+
severity: DiagnosticSeverity.Warning,
409+
},
371410
{
372411
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
373412
message:
374413
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106',
375414
path: ['paths', '/resourceThree', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
376415
severity: DiagnosticSeverity.Warning,
377416
},
417+
{
418+
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
419+
message:
420+
'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/106',
421+
path: ['paths', '/resourceFour', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
422+
severity: DiagnosticSeverity.Warning,
423+
},
378424
{
379425
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
380426
message:
381427
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106',
382428
path: ['paths', '/resourceCircular', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
383429
severity: DiagnosticSeverity.Warning,
384430
},
431+
{
432+
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
433+
message:
434+
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106',
435+
path: ['paths', '/resourceCircular', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
436+
severity: DiagnosticSeverity.Warning,
437+
},
385438
],
386439
},
387440
{
@@ -432,6 +485,13 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
432485
path: ['paths', '/animalResource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'],
433486
severity: DiagnosticSeverity.Warning,
434487
},
488+
{
489+
code: 'xgen-IPA-106-create-method-request-body-is-get-method-response',
490+
message:
491+
'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106',
492+
path: ['paths', '/animalResource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'],
493+
severity: DiagnosticSeverity.Warning,
494+
},
435495
],
436496
},
437497
{
@@ -455,6 +515,9 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
455515
schema: {
456516
$ref: '#/components/schemas/SchemaOne',
457517
},
518+
'x-xgen-IPA-exception': {
519+
'xgen-IPA-106-create-method-request-body-is-get-method-response': 'reason',
520+
},
458521
},
459522
},
460523
},
@@ -491,6 +554,9 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
491554
schema: {
492555
$ref: '#/components/schemas/SchemaTwo',
493556
},
557+
'x-xgen-IPA-exception': {
558+
'xgen-IPA-106-create-method-request-body-is-get-method-response': 'reason',
559+
},
494560
},
495561
},
496562
},

0 commit comments

Comments
 (0)