diff --git a/tools/spectral/ipa/__tests__/IPA117OperationSummaryCreateStartsWith.test.js b/tools/spectral/ipa/__tests__/IPA117OperationSummaryCreateStartsWith.test.js index 15497e4ba2..1eab81d998 100644 --- a/tools/spectral/ipa/__tests__/IPA117OperationSummaryCreateStartsWith.test.js +++ b/tools/spectral/ipa/__tests__/IPA117OperationSummaryCreateStartsWith.test.js @@ -56,13 +56,13 @@ testRule('xgen-IPA-117-create-operation-summary-starts-with', [ code: 'xgen-IPA-117-create-operation-summary-starts-with', message: 'Operation summary must start with one of the words [Create,Add].', path: ['paths', '/resource', 'post'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-create-operation-summary-starts-with', message: 'Operation summary must start with one of the words [Create,Add].', path: ['paths', '/projects/{id}/users', 'post'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117OperationSummaryDeleteStartsWith.test.js b/tools/spectral/ipa/__tests__/IPA117OperationSummaryDeleteStartsWith.test.js index 4d22c51fec..2a84108423 100644 --- a/tools/spectral/ipa/__tests__/IPA117OperationSummaryDeleteStartsWith.test.js +++ b/tools/spectral/ipa/__tests__/IPA117OperationSummaryDeleteStartsWith.test.js @@ -41,13 +41,13 @@ testRule('xgen-IPA-117-delete-operation-summary-starts-with', [ code: 'xgen-IPA-117-delete-operation-summary-starts-with', message: 'Operation summary must start with one of the words [Delete,Remove].', path: ['paths', '/resource', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-delete-operation-summary-starts-with', message: 'Operation summary must start with one of the words [Delete,Remove].', path: ['paths', '/projects/{id}/users', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117OperationSummaryFormat.test.js b/tools/spectral/ipa/__tests__/IPA117OperationSummaryFormat.test.js index 851eb56780..4a77e7d3f2 100644 --- a/tools/spectral/ipa/__tests__/IPA117OperationSummaryFormat.test.js +++ b/tools/spectral/ipa/__tests__/IPA117OperationSummaryFormat.test.js @@ -46,25 +46,25 @@ testRule('xgen-IPA-117-operation-summary-format', [ code: 'xgen-IPA-117-operation-summary-format', message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.', path: ['paths', '/resource/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-operation-summary-format', message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.', path: ['paths', '/resource', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-operation-summary-format', message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.', path: ['paths', '/resource/{id}/child', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-operation-summary-format', message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.', path: ['paths', '/resource/{id}/child/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117OperationSummaryGetStartsWith.test.js b/tools/spectral/ipa/__tests__/IPA117OperationSummaryGetStartsWith.test.js index ed7b1b358d..c7d215dbfb 100644 --- a/tools/spectral/ipa/__tests__/IPA117OperationSummaryGetStartsWith.test.js +++ b/tools/spectral/ipa/__tests__/IPA117OperationSummaryGetStartsWith.test.js @@ -41,19 +41,19 @@ testRule('xgen-IPA-117-get-operation-summary-starts-with', [ code: 'xgen-IPA-117-get-operation-summary-starts-with', message: 'Operation summary must start with the word "Return".', path: ['paths', '/resource/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-get-operation-summary-starts-with', message: 'Operation summary must start with the word "Return".', path: ['paths', '/resource', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-get-operation-summary-starts-with', message: 'Operation summary must start with the word "Return".', path: ['paths', '/resource/{id}/child', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117OperationSummarySingleItemWording.test.js b/tools/spectral/ipa/__tests__/IPA117OperationSummarySingleItemWording.test.js index 86122357e0..8e91bca44f 100644 --- a/tools/spectral/ipa/__tests__/IPA117OperationSummarySingleItemWording.test.js +++ b/tools/spectral/ipa/__tests__/IPA117OperationSummarySingleItemWording.test.js @@ -46,31 +46,31 @@ testRule('xgen-IPA-117-operation-summary-single-item-wording', [ code: 'xgen-IPA-117-operation-summary-single-item-wording', message: 'Operation summary referring to a single item must use "one" instead of "provided".', path: ['paths', '/resource1/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-operation-summary-single-item-wording', message: 'Operation summary referring to a single item must use "one" instead of "specified".', path: ['paths', '/resource2/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-operation-summary-single-item-wording', message: 'Operation summary referring to a single item must use "one" instead of "a".', path: ['paths', '/resource3/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-operation-summary-single-item-wording', message: 'Operation summary referring to a single item must use "one" instead of "a".', path: ['paths', '/resource4/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-operation-summary-single-item-wording', message: 'Operation summary referring to a single item must use "one" instead of "provided".', path: ['paths', '/resource4/{id}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117OperationSummaryUpdateStartsWith.test.js b/tools/spectral/ipa/__tests__/IPA117OperationSummaryUpdateStartsWith.test.js index 5b016bf72a..d7d64d29b8 100644 --- a/tools/spectral/ipa/__tests__/IPA117OperationSummaryUpdateStartsWith.test.js +++ b/tools/spectral/ipa/__tests__/IPA117OperationSummaryUpdateStartsWith.test.js @@ -41,13 +41,13 @@ testRule('xgen-IPA-117-update-operation-summary-starts-with', [ code: 'xgen-IPA-117-update-operation-summary-starts-with', message: 'Operation summary must start with the word "Update".', path: ['paths', '/resource', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-update-operation-summary-starts-with', message: 'Operation summary must start with the word "Update".', path: ['paths', '/projects/{id}/users', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA125DiscriminatorMustAccompanyOneOfAnyOfAllOf.test.js b/tools/spectral/ipa/__tests__/IPA125DiscriminatorMustAccompanyOneOfAnyOfAllOf.test.js index b4859bd16d..22db55ab60 100644 --- a/tools/spectral/ipa/__tests__/IPA125DiscriminatorMustAccompanyOneOfAnyOfAllOf.test.js +++ b/tools/spectral/ipa/__tests__/IPA125DiscriminatorMustAccompanyOneOfAnyOfAllOf.test.js @@ -71,13 +71,13 @@ testRule('xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf', [ code: 'xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf', message: "Each discriminator property must be accompanied by a 'oneOf', 'anyOf' or 'allOf' property.", path: ['components', 'schemas', 'Schema'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf', message: "Each discriminator property must be accompanied by a 'oneOf', 'anyOf' or 'allOf' property.", path: ['components', 'schemas', 'NestedSchema', 'properties', 'name'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA125OneOfSchemaPropertySameType.test.js b/tools/spectral/ipa/__tests__/IPA125OneOfSchemaPropertySameType.test.js index 84fb6306b0..f8a52879d3 100644 --- a/tools/spectral/ipa/__tests__/IPA125OneOfSchemaPropertySameType.test.js +++ b/tools/spectral/ipa/__tests__/IPA125OneOfSchemaPropertySameType.test.js @@ -61,7 +61,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [ code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchemaInvalid'], message: "Property 'id' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -96,13 +96,13 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [ code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchemaInvalid'], message: "Property 'id' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchemaInvalid'], message: "Property 'age' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -239,13 +239,13 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [ code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchemaInvalid'], message: "Property 'name' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchemaInvalid'], message: "Property 'address' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -388,7 +388,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [ code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchema', 'properties', 'name'], message: "Property 'first' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -539,7 +539,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [ code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchema'], message: "Property 'counter' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -682,7 +682,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [ code: 'xgen-IPA-125-oneOf-schema-property-same-type', path: ['components', 'schemas', 'ExampleSchema'], message: "Property 'threshold' has different types or schemas in oneOf items.", - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/ipa-spectral.yaml b/tools/spectral/ipa/ipa-spectral.yaml index a8164e9f8a..a5917571be 100644 --- a/tools/spectral/ipa/ipa-spectral.yaml +++ b/tools/spectral/ipa/ipa-spectral.yaml @@ -250,3 +250,19 @@ overrides: - '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayInvitations%3Areject/post' rules: xgen-IPA-109-valid-operation-id: 'off' + - files: # To be removed in CLOUDP-344586 + - '**#/components/schemas/ThirdPartyIntegration' + rules: + xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf: 'off' + - files: # To be removed in CLOUDP-344586 + - '**#/paths/~1api~1atlas~1v2~1openapi~1info/get' + - '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1sandboxConfig~1%7BsandboxConfigId%7D/delete' + - '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1sandboxConfig~1%7BsandboxConfigId%7D/get' + - '**#/paths/~1api~1atlas~1v2~1unauth~1openapi~1versions/get' + rules: + xgen-IPA-117-operation-summary-format: 'off' + - files: # To be removed in CLOUDP-344586 + - '**#/paths/~1api~1atlas~1v2~1unauth~1openapi~1versions/get' + rules: + xgen-IPA-117-get-operation-summary-starts-with: 'off' + xgen-IPA-117-operation-summary-single-item-wording: 'off' diff --git a/tools/spectral/ipa/rulesets/IPA-117.yaml b/tools/spectral/ipa/rulesets/IPA-117.yaml index 89415029d1..8bd803690c 100644 --- a/tools/spectral/ipa/rulesets/IPA-117.yaml +++ b/tools/spectral/ipa/rulesets/IPA-117.yaml @@ -237,7 +237,7 @@ rules: - `ignoreList`: Words that are allowed to maintain their specific casing (e.g., "API", "AWS", "DNS") - `grammaticalWords`: Common words that can remain lowercase in titles (e.g., "and", "or", "the") message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-operation-summary-format' - severity: warn + severity: error given: - '#OperationObject.summary' then: @@ -295,7 +295,7 @@ rules: This rule includes a configuration option: - `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Return']` message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-get-operation-summary-starts-with' - severity: warn + severity: error given: - '$.paths[*][get].summary' then: @@ -314,7 +314,7 @@ rules: This rule includes a configuration option: - `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Update']` message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-update-operation-summary-starts-with' - severity: warn + severity: error given: - '$.paths[*][put,patch].summary' then: @@ -333,7 +333,7 @@ rules: This rule includes a configuration option: - `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Create', 'Add']` message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-create-operation-summary-starts-with' - severity: warn + severity: error given: - '$.paths[*][post].summary' then: @@ -353,7 +353,7 @@ rules: This rule includes a configuration option: - `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Delete', 'Remove']` message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-delete-operation-summary-starts-with' - severity: warn + severity: error given: - '$.paths[*][delete].summary' then: @@ -374,7 +374,7 @@ rules: - `preferredWords`: List of words that the operation summary should use for single items, defaults to `['one']`. Only used for error messages - `forbiddenWords`: List of words (lowercase) that the operation summary should not use, defaults to `['a', 'specified']` message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-operation-summary-single-item-wording' - severity: warn + severity: error given: - '#OperationObject.summary' then: diff --git a/tools/spectral/ipa/rulesets/IPA-125.yaml b/tools/spectral/ipa/rulesets/IPA-125.yaml index a4d82eb851..465fbb34be 100644 --- a/tools/spectral/ipa/rulesets/IPA-125.yaml +++ b/tools/spectral/ipa/rulesets/IPA-125.yaml @@ -76,7 +76,7 @@ rules: - Ensures that if a property is defined in multiple `oneOf` schemas, it must have the same type in each schema (base type or object schema) message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-125-oneOf-schema-property-same-type' - severity: warn + severity: error given: '$.components.schemas..oneOf' then: function: 'IPA125OneOfSchemaPropertySameType' @@ -88,7 +88,7 @@ rules: ##### Implementation details - Rule checks that a `discriminator` property has a `oneOf`, `anyOf` or `allOf` sibling message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf' - severity: warn + severity: error given: '$..discriminator' then: function: 'IPA125DiscriminatorMustAccompanyOneOfAnyOfAllOf' diff --git a/tools/spectral/ipa/rulesets/README.md b/tools/spectral/ipa/rulesets/README.md index 01a568fca8..b9c9989c55 100644 --- a/tools/spectral/ipa/rulesets/README.md +++ b/tools/spectral/ipa/rulesets/README.md @@ -883,7 +883,7 @@ The rule checks for the presence of the `schema`, `examples` or `example` proper #### xgen-IPA-117-operation-summary-format - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Operation summaries must use Title Case, must not end with a period and must not use CommonMark. ##### Implementation details @@ -896,7 +896,7 @@ This rule includes two configuration options: #### xgen-IPA-117-get-operation-summary-starts-with - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) In operation summaries, use 'Return' instead of 'Get' or 'List'. For example "Return One Identity Provider". ##### Implementation details @@ -908,7 +908,7 @@ This rule includes a configuration option: #### xgen-IPA-117-update-operation-summary-starts-with - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) In operation summaries, use 'Update' instead of 'Modify' or 'Change'. For example "Update One Identity Provider". ##### Implementation details @@ -920,7 +920,7 @@ This rule includes a configuration option: #### xgen-IPA-117-create-operation-summary-starts-with - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) In operation summaries, use 'Create' when the operation is creating a resource, and use 'Add' when the resource itself isn't being created. For example "Create One Identity Provider" or "Add One MongoDB Cloud User to One Project". ##### Implementation details @@ -932,7 +932,7 @@ This rule includes a configuration option: #### xgen-IPA-117-delete-operation-summary-starts-with - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) In operation summaries, use 'Delete' when the operation is destroying a resource, and use 'Remove' when the resource itself isn't being destroyed. For example "Delete One Identity Provider" or "Remove One MongoDB Cloud User from One Project". ##### Implementation details @@ -944,7 +944,7 @@ This rule includes a configuration option: #### xgen-IPA-117-operation-summary-single-item-wording - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) API Producers must use "One" when referring to a single item instead of "a" or "specified". ##### Implementation details @@ -1103,7 +1103,7 @@ object types with clear discriminators. #### xgen-IPA-125-oneOf-schema-property-same-type - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) If multiple `oneOf` models define a property with the same name, that property **must** have the same base type or schema in each model ##### Implementation details @@ -1113,7 +1113,7 @@ Rule checks for the following conditions: #### xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Each discriminator property must be accompanied by a `oneOf`, `anyOf` or `allOf` property ##### Implementation details