Skip to content

Commit 69dd477

Browse files
feat(ipa): Upgrade warning-level rules to the error level (#952)
1 parent 31ab77d commit 69dd477

12 files changed

+60
-44
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ testRule('xgen-IPA-117-create-operation-summary-starts-with', [
5656
code: 'xgen-IPA-117-create-operation-summary-starts-with',
5757
message: 'Operation summary must start with one of the words [Create,Add].',
5858
path: ['paths', '/resource', 'post'],
59-
severity: DiagnosticSeverity.Warning,
59+
severity: DiagnosticSeverity.Error,
6060
},
6161
{
6262
code: 'xgen-IPA-117-create-operation-summary-starts-with',
6363
message: 'Operation summary must start with one of the words [Create,Add].',
6464
path: ['paths', '/projects/{id}/users', 'post'],
65-
severity: DiagnosticSeverity.Warning,
65+
severity: DiagnosticSeverity.Error,
6666
},
6767
],
6868
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ testRule('xgen-IPA-117-delete-operation-summary-starts-with', [
4141
code: 'xgen-IPA-117-delete-operation-summary-starts-with',
4242
message: 'Operation summary must start with one of the words [Delete,Remove].',
4343
path: ['paths', '/resource', 'delete'],
44-
severity: DiagnosticSeverity.Warning,
44+
severity: DiagnosticSeverity.Error,
4545
},
4646
{
4747
code: 'xgen-IPA-117-delete-operation-summary-starts-with',
4848
message: 'Operation summary must start with one of the words [Delete,Remove].',
4949
path: ['paths', '/projects/{id}/users', 'delete'],
50-
severity: DiagnosticSeverity.Warning,
50+
severity: DiagnosticSeverity.Error,
5151
},
5252
],
5353
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,25 @@ testRule('xgen-IPA-117-operation-summary-format', [
4646
code: 'xgen-IPA-117-operation-summary-format',
4747
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
4848
path: ['paths', '/resource/{id}', 'get'],
49-
severity: DiagnosticSeverity.Warning,
49+
severity: DiagnosticSeverity.Error,
5050
},
5151
{
5252
code: 'xgen-IPA-117-operation-summary-format',
5353
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
5454
path: ['paths', '/resource', 'get'],
55-
severity: DiagnosticSeverity.Warning,
55+
severity: DiagnosticSeverity.Error,
5656
},
5757
{
5858
code: 'xgen-IPA-117-operation-summary-format',
5959
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
6060
path: ['paths', '/resource/{id}/child', 'get'],
61-
severity: DiagnosticSeverity.Warning,
61+
severity: DiagnosticSeverity.Error,
6262
},
6363
{
6464
code: 'xgen-IPA-117-operation-summary-format',
6565
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
6666
path: ['paths', '/resource/{id}/child/{id}', 'get'],
67-
severity: DiagnosticSeverity.Warning,
67+
severity: DiagnosticSeverity.Error,
6868
},
6969
],
7070
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ testRule('xgen-IPA-117-get-operation-summary-starts-with', [
4141
code: 'xgen-IPA-117-get-operation-summary-starts-with',
4242
message: 'Operation summary must start with the word "Return".',
4343
path: ['paths', '/resource/{id}', 'get'],
44-
severity: DiagnosticSeverity.Warning,
44+
severity: DiagnosticSeverity.Error,
4545
},
4646
{
4747
code: 'xgen-IPA-117-get-operation-summary-starts-with',
4848
message: 'Operation summary must start with the word "Return".',
4949
path: ['paths', '/resource', 'get'],
50-
severity: DiagnosticSeverity.Warning,
50+
severity: DiagnosticSeverity.Error,
5151
},
5252
{
5353
code: 'xgen-IPA-117-get-operation-summary-starts-with',
5454
message: 'Operation summary must start with the word "Return".',
5555
path: ['paths', '/resource/{id}/child', 'get'],
56-
severity: DiagnosticSeverity.Warning,
56+
severity: DiagnosticSeverity.Error,
5757
},
5858
],
5959
},

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,31 @@ testRule('xgen-IPA-117-operation-summary-single-item-wording', [
4646
code: 'xgen-IPA-117-operation-summary-single-item-wording',
4747
message: 'Operation summary referring to a single item must use "one" instead of "provided".',
4848
path: ['paths', '/resource1/{id}', 'get'],
49-
severity: DiagnosticSeverity.Warning,
49+
severity: DiagnosticSeverity.Error,
5050
},
5151
{
5252
code: 'xgen-IPA-117-operation-summary-single-item-wording',
5353
message: 'Operation summary referring to a single item must use "one" instead of "specified".',
5454
path: ['paths', '/resource2/{id}', 'get'],
55-
severity: DiagnosticSeverity.Warning,
55+
severity: DiagnosticSeverity.Error,
5656
},
5757
{
5858
code: 'xgen-IPA-117-operation-summary-single-item-wording',
5959
message: 'Operation summary referring to a single item must use "one" instead of "a".',
6060
path: ['paths', '/resource3/{id}', 'get'],
61-
severity: DiagnosticSeverity.Warning,
61+
severity: DiagnosticSeverity.Error,
6262
},
6363
{
6464
code: 'xgen-IPA-117-operation-summary-single-item-wording',
6565
message: 'Operation summary referring to a single item must use "one" instead of "a".',
6666
path: ['paths', '/resource4/{id}', 'get'],
67-
severity: DiagnosticSeverity.Warning,
67+
severity: DiagnosticSeverity.Error,
6868
},
6969
{
7070
code: 'xgen-IPA-117-operation-summary-single-item-wording',
7171
message: 'Operation summary referring to a single item must use "one" instead of "provided".',
7272
path: ['paths', '/resource4/{id}', 'get'],
73-
severity: DiagnosticSeverity.Warning,
73+
severity: DiagnosticSeverity.Error,
7474
},
7575
],
7676
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ testRule('xgen-IPA-117-update-operation-summary-starts-with', [
4141
code: 'xgen-IPA-117-update-operation-summary-starts-with',
4242
message: 'Operation summary must start with the word "Update".',
4343
path: ['paths', '/resource', 'patch'],
44-
severity: DiagnosticSeverity.Warning,
44+
severity: DiagnosticSeverity.Error,
4545
},
4646
{
4747
code: 'xgen-IPA-117-update-operation-summary-starts-with',
4848
message: 'Operation summary must start with the word "Update".',
4949
path: ['paths', '/projects/{id}/users', 'put'],
50-
severity: DiagnosticSeverity.Warning,
50+
severity: DiagnosticSeverity.Error,
5151
},
5252
],
5353
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ testRule('xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf', [
7171
code: 'xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf',
7272
message: "Each discriminator property must be accompanied by a 'oneOf', 'anyOf' or 'allOf' property.",
7373
path: ['components', 'schemas', 'Schema'],
74-
severity: DiagnosticSeverity.Warning,
74+
severity: DiagnosticSeverity.Error,
7575
},
7676
{
7777
code: 'xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf',
7878
message: "Each discriminator property must be accompanied by a 'oneOf', 'anyOf' or 'allOf' property.",
7979
path: ['components', 'schemas', 'NestedSchema', 'properties', 'name'],
80-
severity: DiagnosticSeverity.Warning,
80+
severity: DiagnosticSeverity.Error,
8181
},
8282
],
8383
},

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
6161
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
6262
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
6363
message: "Property 'id' has different types or schemas in oneOf items.",
64-
severity: DiagnosticSeverity.Warning,
64+
severity: DiagnosticSeverity.Error,
6565
},
6666
],
6767
},
@@ -96,13 +96,13 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
9696
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
9797
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
9898
message: "Property 'id' has different types or schemas in oneOf items.",
99-
severity: DiagnosticSeverity.Warning,
99+
severity: DiagnosticSeverity.Error,
100100
},
101101
{
102102
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
103103
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
104104
message: "Property 'age' has different types or schemas in oneOf items.",
105-
severity: DiagnosticSeverity.Warning,
105+
severity: DiagnosticSeverity.Error,
106106
},
107107
],
108108
},
@@ -239,13 +239,13 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
239239
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
240240
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
241241
message: "Property 'name' has different types or schemas in oneOf items.",
242-
severity: DiagnosticSeverity.Warning,
242+
severity: DiagnosticSeverity.Error,
243243
},
244244
{
245245
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
246246
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
247247
message: "Property 'address' has different types or schemas in oneOf items.",
248-
severity: DiagnosticSeverity.Warning,
248+
severity: DiagnosticSeverity.Error,
249249
},
250250
],
251251
},
@@ -388,7 +388,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
388388
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
389389
path: ['components', 'schemas', 'ExampleSchema', 'properties', 'name'],
390390
message: "Property 'first' has different types or schemas in oneOf items.",
391-
severity: DiagnosticSeverity.Warning,
391+
severity: DiagnosticSeverity.Error,
392392
},
393393
],
394394
},
@@ -539,7 +539,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
539539
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
540540
path: ['components', 'schemas', 'ExampleSchema'],
541541
message: "Property 'counter' has different types or schemas in oneOf items.",
542-
severity: DiagnosticSeverity.Warning,
542+
severity: DiagnosticSeverity.Error,
543543
},
544544
],
545545
},
@@ -682,7 +682,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
682682
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
683683
path: ['components', 'schemas', 'ExampleSchema'],
684684
message: "Property 'threshold' has different types or schemas in oneOf items.",
685-
severity: DiagnosticSeverity.Warning,
685+
severity: DiagnosticSeverity.Error,
686686
},
687687
],
688688
},

tools/spectral/ipa/ipa-spectral.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,19 @@ overrides:
250250
- '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayInvitations%3Areject/post'
251251
rules:
252252
xgen-IPA-109-valid-operation-id: 'off'
253+
- files: # To be removed in CLOUDP-344586
254+
- '**#/components/schemas/ThirdPartyIntegration'
255+
rules:
256+
xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf: 'off'
257+
- files: # To be removed in CLOUDP-344586
258+
- '**#/paths/~1api~1atlas~1v2~1openapi~1info/get'
259+
- '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1sandboxConfig~1%7BsandboxConfigId%7D/delete'
260+
- '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1sandboxConfig~1%7BsandboxConfigId%7D/get'
261+
- '**#/paths/~1api~1atlas~1v2~1unauth~1openapi~1versions/get'
262+
rules:
263+
xgen-IPA-117-operation-summary-format: 'off'
264+
- files: # To be removed in CLOUDP-344586
265+
- '**#/paths/~1api~1atlas~1v2~1unauth~1openapi~1versions/get'
266+
rules:
267+
xgen-IPA-117-get-operation-summary-starts-with: 'off'
268+
xgen-IPA-117-operation-summary-single-item-wording: 'off'

tools/spectral/ipa/rulesets/IPA-117.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ rules:
237237
- `ignoreList`: Words that are allowed to maintain their specific casing (e.g., "API", "AWS", "DNS")
238238
- `grammaticalWords`: Common words that can remain lowercase in titles (e.g., "and", "or", "the")
239239
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-operation-summary-format'
240-
severity: warn
240+
severity: error
241241
given:
242242
- '#OperationObject.summary'
243243
then:
@@ -295,7 +295,7 @@ rules:
295295
This rule includes a configuration option:
296296
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Return']`
297297
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-get-operation-summary-starts-with'
298-
severity: warn
298+
severity: error
299299
given:
300300
- '$.paths[*][get].summary'
301301
then:
@@ -314,7 +314,7 @@ rules:
314314
This rule includes a configuration option:
315315
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Update']`
316316
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-update-operation-summary-starts-with'
317-
severity: warn
317+
severity: error
318318
given:
319319
- '$.paths[*][put,patch].summary'
320320
then:
@@ -333,7 +333,7 @@ rules:
333333
This rule includes a configuration option:
334334
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Create', 'Add']`
335335
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-create-operation-summary-starts-with'
336-
severity: warn
336+
severity: error
337337
given:
338338
- '$.paths[*][post].summary'
339339
then:
@@ -353,7 +353,7 @@ rules:
353353
This rule includes a configuration option:
354354
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Delete', 'Remove']`
355355
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-delete-operation-summary-starts-with'
356-
severity: warn
356+
severity: error
357357
given:
358358
- '$.paths[*][delete].summary'
359359
then:
@@ -374,7 +374,7 @@ rules:
374374
- `preferredWords`: List of words that the operation summary should use for single items, defaults to `['one']`. Only used for error messages
375375
- `forbiddenWords`: List of words (lowercase) that the operation summary should not use, defaults to `['a', 'specified']`
376376
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-operation-summary-single-item-wording'
377-
severity: warn
377+
severity: error
378378
given:
379379
- '#OperationObject.summary'
380380
then:

0 commit comments

Comments
 (0)