diff --git a/tools/spectral/ipa/__tests__/IPA114ApiErrorHasBadRequestDetail.test.js b/tools/spectral/ipa/__tests__/IPA114ApiErrorHasBadRequestDetail.test.js index ea853a382b..cfbfd33e84 100644 --- a/tools/spectral/ipa/__tests__/IPA114ApiErrorHasBadRequestDetail.test.js +++ b/tools/spectral/ipa/__tests__/IPA114ApiErrorHasBadRequestDetail.test.js @@ -53,7 +53,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [ code: 'xgen-IPA-114-api-error-has-bad-request-detail', message: 'ApiError schema must have badRequestDetail field.', path: ['components', 'schemas', 'ApiError'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -75,7 +75,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [ code: 'xgen-IPA-114-api-error-has-bad-request-detail', message: 'ApiError schema must have badRequestDetail field.', path: ['components', 'schemas', 'ApiError'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -101,7 +101,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [ code: 'xgen-IPA-114-api-error-has-bad-request-detail', message: 'badRequestDetail must include an array of fields.', path: ['components', 'schemas', 'ApiError'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -129,7 +129,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [ code: 'xgen-IPA-114-api-error-has-bad-request-detail', message: 'badRequestDetail must include an array of fields.', path: ['components', 'schemas', 'ApiError'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -161,7 +161,7 @@ testRule('xgen-IPA-114-api-error-has-bad-request-detail', [ code: 'xgen-IPA-114-api-error-has-bad-request-detail', message: 'Each field must include description and field properties.', path: ['components', 'schemas', 'ApiError'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA114AuthenticatedEndpointsHaveAuthErrors.test.js b/tools/spectral/ipa/__tests__/IPA114AuthenticatedEndpointsHaveAuthErrors.test.js index a514ab9f81..3d44801b14 100644 --- a/tools/spectral/ipa/__tests__/IPA114AuthenticatedEndpointsHaveAuthErrors.test.js +++ b/tools/spectral/ipa/__tests__/IPA114AuthenticatedEndpointsHaveAuthErrors.test.js @@ -37,13 +37,13 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [ code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors', message: 'Authenticated endpoint must define a 401 response.', path: ['paths', '/resources', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors', message: 'Authenticated endpoint must define a 403 response.', path: ['paths', '/resources', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -66,7 +66,7 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [ code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors', message: 'Authenticated endpoint must define a 401 response.', path: ['paths', '/resources', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -89,7 +89,7 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [ code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors', message: 'Authenticated endpoint must define a 403 response.', path: ['paths', '/resources', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -154,7 +154,7 @@ testRule('xgen-IPA-114-authenticated-endpoints-have-auth-errors', [ code: 'xgen-IPA-114-authenticated-endpoints-have-auth-errors', message: 'Authenticated endpoint must define a 401 and 403 responses.', path: ['paths', '/resources', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA114ErrorResponsesReferToApiError.test.js b/tools/spectral/ipa/__tests__/IPA114ErrorResponsesReferToApiError.test.js index 3e994073f7..9044ba41c1 100644 --- a/tools/spectral/ipa/__tests__/IPA114ErrorResponsesReferToApiError.test.js +++ b/tools/spectral/ipa/__tests__/IPA114ErrorResponsesReferToApiError.test.js @@ -93,7 +93,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [ code: 'xgen-IPA-114-error-responses-refer-to-api-error', message: '400 response must define a schema referencing ApiError.', path: ['paths', '/resources', 'get', 'responses', '400', 'content', 'application/json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -115,7 +115,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [ code: 'xgen-IPA-114-error-responses-refer-to-api-error', message: '400 response must define content with ApiError schema reference.', path: ['paths', '/resources', 'get', 'responses', '400'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -157,7 +157,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [ code: 'xgen-IPA-114-error-responses-refer-to-api-error', message: '500 response must reference ApiError schema.', path: ['paths', '/resources', 'get', 'responses', '500', 'content', 'application/json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -192,7 +192,7 @@ testRule('xgen-IPA-114-error-responses-refer-to-api-error', [ code: 'xgen-IPA-114-error-responses-refer-to-api-error', message: '404 response must reference ApiError schema.', path: ['paths', '/resources', 'get', 'responses', '404', 'content', 'application/json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA114ParameterizedPathsHave404NotFound.test.js b/tools/spectral/ipa/__tests__/IPA114ParameterizedPathsHave404NotFound.test.js index 64ba69243b..da950862d6 100644 --- a/tools/spectral/ipa/__tests__/IPA114ParameterizedPathsHave404NotFound.test.js +++ b/tools/spectral/ipa/__tests__/IPA114ParameterizedPathsHave404NotFound.test.js @@ -36,7 +36,7 @@ testRule('xgen-IPA-114-parameterized-paths-have-404-not-found', [ code: 'xgen-IPA-114-parameterized-paths-have-404-not-found', message: 'Parameterized path must define a 404 response.', path: ['paths', '/resources/{resourceId}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -85,7 +85,7 @@ testRule('xgen-IPA-114-parameterized-paths-have-404-not-found', [ code: 'xgen-IPA-114-parameterized-paths-have-404-not-found', message: 'Parameterized path must define a 404 response.', path: ['paths', '/resources/{resourceId}', 'get'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117ObjectsMustBeWellDefined.test.js b/tools/spectral/ipa/__tests__/IPA117ObjectsMustBeWellDefined.test.js index 6269961e2f..6ae3ea5f32 100644 --- a/tools/spectral/ipa/__tests__/IPA117ObjectsMustBeWellDefined.test.js +++ b/tools/spectral/ipa/__tests__/IPA117ObjectsMustBeWellDefined.test.js @@ -173,7 +173,7 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [ 'content', 'application/vnd.atlas.2024-08-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-objects-must-be-well-defined', @@ -190,7 +190,7 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [ 'properties', 'name', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-objects-must-be-well-defined', @@ -208,42 +208,42 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [ 'hobbies', 'items', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-objects-must-be-well-defined', message: 'Components of type "object" must be well-defined with for example a schema, example(s) or properties.', path: ['paths', '/resource/{id}', 'get', 'requestBody', 'content', 'application/vnd.atlas.2023-08-05+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-objects-must-be-well-defined', message: 'Components of type "object" must be well-defined with for example a schema, example(s) or properties.', path: ['components', 'schemas', 'SchemaOneOf'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-objects-must-be-well-defined', message: 'Components of type "object" must be well-defined with for example a schema, example(s) or properties.', path: ['components', 'schemas', 'SchemaAllOf'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-objects-must-be-well-defined', message: 'Components of type "object" must be well-defined with for example a schema, example(s) or properties.', path: ['components', 'schemas', 'SchemaAnyOf'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-objects-must-be-well-defined', message: 'Components of type "object" must be well-defined with for example a schema, example(s) or properties.', path: ['components', 'schemas', 'ArraySchema', 'items'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -279,7 +279,7 @@ testRule('xgen-IPA-117-objects-must-be-well-defined', [ message: 'Components of type "object" must be well-defined with for example a schema, example(s) or properties.', path: ['components', 'schemas', 'Schema'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117ParameterHasExamplesOrSchema.test.js b/tools/spectral/ipa/__tests__/IPA117ParameterHasExamplesOrSchema.test.js index 46179af11a..c6f1ab486d 100644 --- a/tools/spectral/ipa/__tests__/IPA117ParameterHasExamplesOrSchema.test.js +++ b/tools/spectral/ipa/__tests__/IPA117ParameterHasExamplesOrSchema.test.js @@ -54,13 +54,13 @@ testRule('xgen-IPA-117-parameter-has-examples-or-schema', [ code: 'xgen-IPA-117-parameter-has-examples-or-schema', message: 'API producers must provide a well-defined schema or example(s) for parameters.', path: ['paths', '/resource/{id}', 'get', 'parameters', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-parameter-has-examples-or-schema', message: 'API producers must provide a well-defined schema or example(s) for parameters.', path: ['components', 'parameters', 'id'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA117PlaintextResponseMustHaveExample.test.js b/tools/spectral/ipa/__tests__/IPA117PlaintextResponseMustHaveExample.test.js index 2e9ac504ce..3f67307273 100644 --- a/tools/spectral/ipa/__tests__/IPA117PlaintextResponseMustHaveExample.test.js +++ b/tools/spectral/ipa/__tests__/IPA117PlaintextResponseMustHaveExample.test.js @@ -97,19 +97,19 @@ testRule('xgen-IPA-117-plaintext-response-must-have-example', [ code: 'xgen-IPA-117-plaintext-response-must-have-example', message: 'For APIs that respond with plain text, for example CSV, API producers must provide an example.', path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'application/vnd.atlas.2022-01-01+csv'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-plaintext-response-must-have-example', message: 'For APIs that respond with plain text, for example CSV, API producers must provide an example.', path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'application/vnd.atlas.2023-01-01+csv'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-117-plaintext-response-must-have-example', message: 'For APIs that respond with plain text, for example CSV, API producers must provide an example.', path: ['paths', '/resource', 'get', 'responses', '200', 'content', 'text/plain'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA118NoAdditionalPropertiesFalse.test.js b/tools/spectral/ipa/__tests__/IPA118NoAdditionalPropertiesFalse.test.js index e5ce9dce7a..1b5e1d5992 100644 --- a/tools/spectral/ipa/__tests__/IPA118NoAdditionalPropertiesFalse.test.js +++ b/tools/spectral/ipa/__tests__/IPA118NoAdditionalPropertiesFalse.test.js @@ -82,7 +82,7 @@ testRule('xgen-IPA-118-no-additional-properties-false', [ message: "Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.", path: ['components', 'schemas', 'ExampleSchema'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -112,7 +112,7 @@ testRule('xgen-IPA-118-no-additional-properties-false', [ message: "Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.", path: ['components', 'schemas', 'ParentSchema', 'properties', 'child'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -143,14 +143,14 @@ testRule('xgen-IPA-118-no-additional-properties-false', [ message: "Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.", path: ['components', 'schemas', 'ParentSchema'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-118-no-additional-properties-false', message: "Schema must not use 'additionalProperties: false'. Consider using 'additionalProperties: true' or omitting the property.", path: ['components', 'schemas', 'ParentSchema', 'properties', 'child'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA119NoDefaultForCloudProviders.test.js b/tools/spectral/ipa/__tests__/IPA119NoDefaultForCloudProviders.test.js index c5bee55724..7e8d8af629 100644 --- a/tools/spectral/ipa/__tests__/IPA119NoDefaultForCloudProviders.test.js +++ b/tools/spectral/ipa/__tests__/IPA119NoDefaultForCloudProviders.test.js @@ -42,7 +42,7 @@ testRule('xgen-IPA-119-no-default-for-cloud-providers', [ code: 'xgen-IPA-119-no-default-for-cloud-providers', message: 'When using a provider field or param, API producers should not define a default value.', path: ['components', 'schemas', 'Schema', 'properties', 'cloudProvider'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -68,7 +68,7 @@ testRule('xgen-IPA-119-no-default-for-cloud-providers', [ code: 'xgen-IPA-119-no-default-for-cloud-providers', message: 'When using a provider field or param, API producers should not define a default value.', path: ['components', 'schemas', 'Schema', 'properties', 'provider'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -137,7 +137,7 @@ testRule('xgen-IPA-119-no-default-for-cloud-providers', [ code: 'xgen-IPA-119-no-default-for-cloud-providers', message: 'When using a provider field or param, API producers should not define a default value.', path: ['paths', '/resources', 'get', 'parameters', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA121DateTimeFieldsMentionISO8601.test.js b/tools/spectral/ipa/__tests__/IPA121DateTimeFieldsMentionISO8601.test.js index ebe3f89e0b..8384000ba3 100644 --- a/tools/spectral/ipa/__tests__/IPA121DateTimeFieldsMentionISO8601.test.js +++ b/tools/spectral/ipa/__tests__/IPA121DateTimeFieldsMentionISO8601.test.js @@ -114,21 +114,21 @@ testRule('xgen-IPA-121-date-time-fields-mention-iso-8601', [ message: 'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.', path: ['components', 'schemas', 'TestSchema', 'properties', 'createdAt'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-121-date-time-fields-mention-iso-8601', message: 'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.', path: ['components', 'schemas', 'TestSchema', 'properties', 'modifiedAt'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-121-date-time-fields-mention-iso-8601', message: 'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.', path: ['components', 'parameters', 'TestParameter'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -204,7 +204,7 @@ testRule('xgen-IPA-121-date-time-fields-mention-iso-8601', [ message: 'API producers must use ISO 8601 date-time format in UTC for all timestamps. Fields must note ISO 8601 and UTC in their description.', path: ['paths', '/resources', 'get', 'parameters', '1'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -254,7 +254,7 @@ testRule('xgen-IPA-121-date-time-fields-mention-iso-8601', [ 'properties', 'expiresAt', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA123EnumValuesShouldNotExceed20.test.js b/tools/spectral/ipa/__tests__/IPA123EnumValuesShouldNotExceed20.test.js index 7669c78f40..18c1acb1e8 100644 --- a/tools/spectral/ipa/__tests__/IPA123EnumValuesShouldNotExceed20.test.js +++ b/tools/spectral/ipa/__tests__/IPA123EnumValuesShouldNotExceed20.test.js @@ -102,7 +102,7 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [ code: 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20', message: 'Inline enum arrays should not exceed 20 values. Current count: 21', path: ['components', 'schemas', 'TestSchema', 'properties', 'status', 'enum'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -174,7 +174,7 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [ code: 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20', message: 'Inline enum arrays should not exceed 20 values. Current count: 21', path: ['components', 'schemas', 'TestSchema', 'properties', 'priority', 'enum'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -247,7 +247,7 @@ testRule('xgen-IPA-123-allowable-enum-values-should-not-exceed-20', [ code: 'xgen-IPA-123-allowable-enum-values-should-not-exceed-20', message: 'Inline enum arrays should not exceed 20 values. Current count: 21', path: ['paths', '/resources', 'get', 'parameters', '0', 'schema', 'enum'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA124ArrayMaxItems.test.js b/tools/spectral/ipa/__tests__/IPA124ArrayMaxItems.test.js index 33bb1d0828..662afb59ef 100644 --- a/tools/spectral/ipa/__tests__/IPA124ArrayMaxItems.test.js +++ b/tools/spectral/ipa/__tests__/IPA124ArrayMaxItems.test.js @@ -76,7 +76,7 @@ testRule('xgen-IPA-124-array-max-items', [ code: 'xgen-IPA-124-array-max-items', message: 'Array must have maxItems property defined to enforce an upper bound on the number of items.', path: ['components', 'schemas', 'InvalidSchema', 'properties', 'arrayProperty'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -106,7 +106,7 @@ testRule('xgen-IPA-124-array-max-items', [ message: 'The maxItems value for arrays must be set to 100 or below, found: 101. If the array field has the chance of being too large, the API should use a sub-resource instead.', path: ['components', 'schemas', 'InvalidSchema', 'properties', 'arrayProperty'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -164,14 +164,14 @@ testRule('xgen-IPA-124-array-max-items', [ message: 'The maxItems value for arrays must be set to 100 or below, found: 500. If the array field has the chance of being too large, the API should use a sub-resource instead.', path: ['components', 'schemas', 'NestedArrays', 'properties', 'outerArray'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-124-array-max-items', message: 'The maxItems value for arrays must be set to 100 or below, found: 500. If the array field has the chance of being too large, the API should use a sub-resource instead.', path: ['components', 'schemas', 'NestedArrays', 'properties', 'outerArray', 'arrayProperty'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -217,7 +217,7 @@ testRule('xgen-IPA-124-array-max-items', [ 'properties', 'arrayProperty', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -248,7 +248,7 @@ testRule('xgen-IPA-124-array-max-items', [ code: 'xgen-IPA-124-array-max-items', message: 'Array must have maxItems property defined to enforce an upper bound on the number of items.', path: ['paths', '/api/resources', 'get', 'parameters', '0', 'schema'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -311,7 +311,7 @@ testRule('xgen-IPA-124-array-max-items', [ 'application/vnd.atlas.2023-01-01+json', 'schema', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -382,7 +382,7 @@ testRule('xgen-IPA-124-array-max-items', [ 'application/vnd.atlas.2023-01-01+json', 'schema', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA126TagNamesShouldUseTitleCase.test.js b/tools/spectral/ipa/__tests__/IPA126TagNamesShouldUseTitleCase.test.js index f2a1073170..6f45a65e61 100644 --- a/tools/spectral/ipa/__tests__/IPA126TagNamesShouldUseTitleCase.test.js +++ b/tools/spectral/ipa/__tests__/IPA126TagNamesShouldUseTitleCase.test.js @@ -28,7 +28,7 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [ code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "userManagement".', path: ['tags', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -42,7 +42,7 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [ code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "user-management".', path: ['tags', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -56,7 +56,7 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [ code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "user_management".', path: ['tags', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -70,7 +70,7 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [ code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "user management".', path: ['tags', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -84,7 +84,7 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [ code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "USER MANAGEMENT".', path: ['tags', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -98,13 +98,13 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [ code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "resourceGroups".', path: ['tags', '1'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "API ENDPOINTS".', path: ['tags', '2'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -143,43 +143,43 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [ code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "Api V1".', path: ['tags', '0'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "Version 2 Resources".', path: ['tags', '1'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "Encryption at Rest using Customer Key Management".', path: ['tags', '4'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "-Test Tag".', path: ['tags', '5'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "Test Tag-".', path: ['tags', '6'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "Test Tag -Name".', path: ['tags', '7'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-126-tag-names-should-use-title-case', message: 'Tag name should use Title Case, found: "the Test Tag".', path: ['tags', '8'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/ipa-spectral.yaml b/tools/spectral/ipa/ipa-spectral.yaml index c52ef721a8..dbbd3aca8f 100644 --- a/tools/spectral/ipa/ipa-spectral.yaml +++ b/tools/spectral/ipa/ipa-spectral.yaml @@ -111,3 +111,16 @@ overrides: - '**#/components/schemas/DataLakeDLSGCPStore/allOf/1/properties/region' # external field, to be covered by CLOUDP-293178 rules: xgen-IPA-123-allowable-enum-values-should-not-exceed-20: 'off' + - files: + - '**#/components/schemas/DataLakeStorage/properties/databases' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeStorage/properties/stores' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeDatabaseInstance/properties/collections' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeDatabaseInstance/properties/views' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeDatabaseCollection/properties/dataSources' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeDatabaseDataSourceSettings/properties/urls' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeS3StoreSettings/allOf/1/properties/additionalStorageClasses' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeAtlasStoreReadPreference/properties/tagSets' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeAtlasStoreReadPreference/properties/tagSets/items' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/DataLakeHTTPStore/allOf/1/properties/urls' # external field, to be covered by CLOUDP-293178 + rules: + xgen-IPA-124-array-max-items: 'off' diff --git a/tools/spectral/ipa/rulesets/IPA-114.yaml b/tools/spectral/ipa/rulesets/IPA-114.yaml index 707af09e4f..c57517ee7b 100644 --- a/tools/spectral/ipa/rulesets/IPA-114.yaml +++ b/tools/spectral/ipa/rulesets/IPA-114.yaml @@ -15,7 +15,7 @@ rules: ##### Implementation details This rule checks that all 4xx and 5xx error responses reference the ApiError schema. message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-114-error-responses-refer-to-api-error' - severity: warn + severity: error resolved: false given: '$.paths[*][*].responses[?(@property.match(/^[45]\d\d$/))]' then: @@ -31,7 +31,7 @@ rules: - Each field must include description and field properties - This rule does not allow exceptions message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-114-api-error-has-bad-request-detail' - severity: warn + severity: error given: $.components.schemas.ApiError then: function: 'IPA114ApiErrorHasBadRequestDetail' @@ -43,7 +43,7 @@ rules: This rule checks that all authenticated endpoints (those without explicit 'security: []' and not containing '/unauth' in the path) include 401 and 403 responses. message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-114-authenticated-endpoints-have-auth-errors' - severity: warn + severity: error given: '$.paths[*][get,put,post,delete,options,head,patch,trace]' then: function: 'IPA114AuthenticatedEndpointsHaveAuthErrors' @@ -56,7 +56,7 @@ rules: in the path) include a 404 response to handle the case when the requested resource is not found. message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-114-parameterized-paths-have-not-found' - severity: warn + severity: error given: '$.paths[*][get,put,post,delete,options,head,patch,trace]' then: function: 'IPA114ParameterizedPathsHave404NotFound' diff --git a/tools/spectral/ipa/rulesets/IPA-117.yaml b/tools/spectral/ipa/rulesets/IPA-117.yaml index a5cec7956a..819c51a9dc 100644 --- a/tools/spectral/ipa/rulesets/IPA-117.yaml +++ b/tools/spectral/ipa/rulesets/IPA-117.yaml @@ -170,7 +170,7 @@ rules: - The rule ignores responses with `format: 'binary'` (i.e. file types) - The rule checks for the presence of the example property as a sibling to the `schema` property, or inside the `schema` object message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-plaintext-response-must-have-example' - severity: warn + severity: error given: - '$.paths[*][get,put,post,delete,options,head,patch,trace].responses[*].content' then: @@ -198,7 +198,7 @@ rules: - `items` properties defined in `components/schemas` The rule is applied to the unresolved OAS, and ignores components with `$ref` properties. Specific paths can be ignored using the `ignoredPaths` option. message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-objects-must-be-well-defined' - severity: warn + severity: error resolved: false given: - '$.paths[*][get,put,post,delete,options,head,patch,trace]..content[*]' @@ -222,7 +222,7 @@ rules: - Operation parameters - Parameters defined in `components/parameters` message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-parameter-has-examples-or-schema' - severity: warn + severity: error given: - '$.paths[*][get,put,post,delete,options,head,patch,trace].parameters[*]' - '$.components.parameters[*]' diff --git a/tools/spectral/ipa/rulesets/IPA-118.yaml b/tools/spectral/ipa/rulesets/IPA-118.yaml index 3634c71737..78c674863a 100644 --- a/tools/spectral/ipa/rulesets/IPA-118.yaml +++ b/tools/spectral/ipa/rulesets/IPA-118.yaml @@ -14,7 +14,7 @@ rules: Schemas without explicit `additionalProperties` settings (which default to true) or with `additionalProperties` set to `true` are compliant. This rule checks all nested schemas, but only parent schemas can be marked for exception. message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-118-no-additional-properties-false' - severity: warn + severity: error given: '$.components.schemas[*]' then: function: 'IPA118NoAdditionalPropertiesFalse' diff --git a/tools/spectral/ipa/rulesets/IPA-119.yaml b/tools/spectral/ipa/rulesets/IPA-119.yaml index d88132f731..78bc8ec816 100644 --- a/tools/spectral/ipa/rulesets/IPA-119.yaml +++ b/tools/spectral/ipa/rulesets/IPA-119.yaml @@ -10,7 +10,7 @@ rules: This rule checks fields and parameters named "cloudProvider" and ensures they do not have a default value. It also checks enum fields that might contain cloud provider values. All cloudProviderEnumValues should be listed in the enum array. - severity: warn + severity: error message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-119-no-default-for-cloud-providers' given: # Target properties with "cloudProvider" in their name diff --git a/tools/spectral/ipa/rulesets/IPA-121.yaml b/tools/spectral/ipa/rulesets/IPA-121.yaml index 60d95f94fd..a1adef5029 100644 --- a/tools/spectral/ipa/rulesets/IPA-121.yaml +++ b/tools/spectral/ipa/rulesets/IPA-121.yaml @@ -17,6 +17,6 @@ rules: - $.paths..requestBody..schema..properties[*] - $.paths..responses..schema..properties[*] resolved: false - severity: warn + severity: error then: function: IPA121DateTimeFieldsMentionISO8601 diff --git a/tools/spectral/ipa/rulesets/IPA-123.yaml b/tools/spectral/ipa/rulesets/IPA-123.yaml index a599e95352..2ac0d1e2f3 100644 --- a/tools/spectral/ipa/rulesets/IPA-123.yaml +++ b/tools/spectral/ipa/rulesets/IPA-123.yaml @@ -34,7 +34,7 @@ rules: - Skips validation if the schema has an exception defined for this rule - This validation threshold can be adjusted by changing the functionOptions.maxEnumValues parameter message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-123-allowable-enum-values-should-not-exceed-20' - severity: warn + severity: error resolved: false given: '$..enum' then: diff --git a/tools/spectral/ipa/rulesets/IPA-124.yaml b/tools/spectral/ipa/rulesets/IPA-124.yaml index 37421d8be8..65978087ad 100644 --- a/tools/spectral/ipa/rulesets/IPA-124.yaml +++ b/tools/spectral/ipa/rulesets/IPA-124.yaml @@ -19,7 +19,7 @@ rules: - maxItems: Required integer parameter specifying the maximum allowed array size (default: 100) - ignore: Required array parameter listing property names to be exempted from validation message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-124-array-max-items' - severity: warn + severity: error resolved: false given: $..[?(@ && @.type === "array")] then: diff --git a/tools/spectral/ipa/rulesets/IPA-126.yaml b/tools/spectral/ipa/rulesets/IPA-126.yaml index a39e766d36..f11f37cc28 100644 --- a/tools/spectral/ipa/rulesets/IPA-126.yaml +++ b/tools/spectral/ipa/rulesets/IPA-126.yaml @@ -20,7 +20,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-126-tag-names-should-use-title-case' - severity: warn + severity: error given: $.tags[?(@.name && @.name.length > 0)] then: function: 'IPA126TagNamesShouldUseTitleCase' diff --git a/tools/spectral/ipa/rulesets/README.md b/tools/spectral/ipa/rulesets/README.md index 68dac890c4..982df35565 100644 --- a/tools/spectral/ipa/rulesets/README.md +++ b/tools/spectral/ipa/rulesets/README.md @@ -597,7 +597,7 @@ Rules are based on [http://go/ipa/IPA-114](http://go/ipa/IPA-114). #### xgen-IPA-114-error-responses-refer-to-api-error - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) APIs must return ApiError when errors occur ##### Implementation details @@ -605,7 +605,7 @@ This rule checks that all 4xx and 5xx error responses reference the ApiError sch #### xgen-IPA-114-api-error-has-bad-request-detail - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) ApiError schema should have badRequestDetail field with proper structure. ##### Implementation details @@ -617,7 +617,7 @@ Rule checks that: #### xgen-IPA-114-authenticated-endpoints-have-auth-errors - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Authenticated endpoints must define 401 and 403 responses. ##### Implementation details @@ -626,7 +626,7 @@ and not containing '/unauth' in the path) include 401 and 403 responses. #### xgen-IPA-114-parameterized-paths-have-404-not-found - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Paths with parameters must define 404 responses. ##### Implementation details @@ -730,7 +730,7 @@ The rule validates that the description content does not include inline markdown #### xgen-IPA-117-plaintext-response-must-have-example - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) For APIs that respond with plain text, for example CSV, API producers must provide an example. Some tools are not able to generate examples for such responses ##### Implementation details @@ -741,7 +741,7 @@ For APIs that respond with plain text, for example CSV, API producers must provi #### xgen-IPA-117-objects-must-be-well-defined - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Components of type "object" must be well-defined, i.e. have of one of the properties: - `schema` - `examples` @@ -762,7 +762,7 @@ The rule is applied to the unresolved OAS, and ignores components with `$ref` pr #### xgen-IPA-117-parameter-has-examples-or-schema - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) API producers must provide a well-defined schema or example(s) for parameters. ##### Implementation details @@ -778,7 +778,7 @@ Rules are based on [http://go/ipa/IPA-118](http://go/ipa/IPA-118). #### xgen-IPA-118-no-additional-properties-false - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Schemas must not use `additionalProperties: false` ##### Implementation details @@ -794,7 +794,7 @@ Rules are based on [http://go/ipa/IPA-119](http://go/ipa/IPA-119). #### xgen-IPA-119-no-default-for-cloud-providers - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) When using a provider field or parameter, API producers should not define a default value. This rule checks fields and parameters named "cloudProvider" and ensures they do not have a default value. It also checks enum fields that might contain cloud provider values. @@ -808,7 +808,7 @@ Rules are based on [http://go/ipa/IPA-121](http://go/ipa/IPA-121). #### xgen-IPA-121-date-time-fields-mention-iso-8601 - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Fields with format="date-time" should mention ISO 8601 and UTC in their description. It collects adoption metrics at schema property level and parameter level @@ -832,7 +832,7 @@ Rule checks for the following conditions: #### xgen-IPA-123-allowable-enum-values-should-not-exceed-20 - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Allowable enum values should not exceed 20 entries. ##### Implementation details @@ -851,7 +851,7 @@ Rules are based on [http://go/ipa/IPA-124](http://go/ipa/IPA-124). #### xgen-IPA-124-array-max-items - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Array fields must have a maxItems property defined to enforce an upper bound on the number of items (recommended max: 100). If the array field has the chance of being too large, the API should use a sub-resource instead. ##### Implementation details @@ -926,7 +926,7 @@ Rules are based on [http://go/ipa/IPA-126](http://go/ipa/IPA-126). #### xgen-IPA-126-tag-names-should-use-title-case - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Tag names in the OpenAPI specification should use Title Case. ##### Implementation details