diff --git a/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierCamelCase.test.js b/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierCamelCase.test.js index a69dca5302..4c8866c516 100644 --- a/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierCamelCase.test.js +++ b/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierCamelCase.test.js @@ -47,7 +47,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources' is not in camelCase.", path: ['paths', '/Resources'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -64,7 +64,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path segment 'resource_groups' in path '/resource_groups' is not in camelCase.", path: ['paths', '/resource_groups'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -81,7 +81,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path segment 'resource-groups' in path '/resource-groups' is not in camelCase.", path: ['paths', '/resource-groups'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -98,7 +98,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path segment 'Resources' in path '/Resources:createResource' is not in camelCase.", path: ['paths', '/Resources:createResource'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -115,7 +115,7 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path segment 'resourcesAPI' in path '/resourcesAPI' is not in camelCase.", path: ['paths', '/resourcesAPI'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -147,21 +147,21 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path '/api//users' contains double slashes (//) which is not allowed.", path: ['paths', '/api//users'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-102-collection-identifier-camelCase', message: "Collection identifiers must be in camelCase. Path '/resources///{resourceId}' contains double slashes (//) which is not allowed.", path: ['paths', '/resources///{resourceId}'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-102-collection-identifier-camelCase', message: "Collection identifiers must be in camelCase. Path '//doubleSlashAtStart' contains double slashes (//) which is not allowed.", path: ['paths', '//doubleSlashAtStart'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -188,21 +188,21 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path segment 'API' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase.", path: ['paths', '/API/Resource_groups/{userId}/User-profiles'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-102-collection-identifier-camelCase', message: "Collection identifiers must be in camelCase. Path segment 'Resource_groups' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase.", path: ['paths', '/API/Resource_groups/{userId}/User-profiles'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-102-collection-identifier-camelCase', message: "Collection identifiers must be in camelCase. Path segment 'User-profiles' in path '/API/Resource_groups/{userId}/User-profiles' is not in camelCase.", path: ['paths', '/API/Resource_groups/{userId}/User-profiles'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -219,14 +219,14 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path segment 'Valid' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase.", path: ['paths', '/api/Valid/Invalid_resource/{id}:validCustomMethod'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-102-collection-identifier-camelCase', message: "Collection identifiers must be in camelCase. Path segment 'Invalid_resource' in path '/api/Valid/Invalid_resource/{id}:validCustomMethod' is not in camelCase.", path: ['paths', '/api/Valid/Invalid_resource/{id}:validCustomMethod'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -243,14 +243,14 @@ testRule('xgen-IPA-102-collection-identifier-camelCase', [ message: "Collection identifiers must be in camelCase. Path '/api//Invalid_segment//resources' contains double slashes (//) which is not allowed.", path: ['paths', '/api//Invalid_segment//resources'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-102-collection-identifier-camelCase', message: "Collection identifiers must be in camelCase. Path segment 'Invalid_segment' in path '/api//Invalid_segment//resources' is not in camelCase.", path: ['paths', '/api//Invalid_segment//resources'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierPattern.test.js b/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierPattern.test.js index 5f9be34033..8b9e7e8f0d 100644 --- a/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierPattern.test.js +++ b/tools/spectral/ipa/__tests__/IPA102CollectionIdentifierPattern.test.js @@ -47,7 +47,7 @@ testRule('xgen-IPA-102-collection-identifier-pattern', [ message: "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.", path: ['paths', '/Resources'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -65,14 +65,14 @@ testRule('xgen-IPA-102-collection-identifier-pattern', [ message: "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.", path: ['paths', '/resource-groups'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-102-collection-identifier-pattern', message: "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.", path: ['paths', '/user_profiles'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA106CreateMethodRequestBodyIsGetResponse.test.js b/tools/spectral/ipa/__tests__/IPA106CreateMethodRequestBodyIsGetResponse.test.js index 81245236ab..3eff93d3bd 100644 --- a/tools/spectral/ipa/__tests__/IPA106CreateMethodRequestBodyIsGetResponse.test.js +++ b/tools/spectral/ipa/__tests__/IPA106CreateMethodRequestBodyIsGetResponse.test.js @@ -394,50 +394,50 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [ code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/resource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/resource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/resourceTwo', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/resourceTwo', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/resourceThree', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: '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.', path: ['paths', '/resourceFour', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/resourceCircular', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/resourceCircular', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -486,13 +486,13 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [ code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/animalResource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-request-body-is-get-method-response', message: 'The request body schema properties must match the response body schema properties of the Get method.', path: ['paths', '/animalResource', 'post', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA106CreateMethodResponseIsGetMethodResponse.test.js b/tools/spectral/ipa/__tests__/IPA106CreateMethodResponseIsGetMethodResponse.test.js index 4ad3c40ce4..b89d30d59b 100644 --- a/tools/spectral/ipa/__tests__/IPA106CreateMethodResponseIsGetMethodResponse.test.js +++ b/tools/spectral/ipa/__tests__/IPA106CreateMethodResponseIsGetMethodResponse.test.js @@ -241,7 +241,7 @@ testRule('xgen-IPA-106-create-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-106-create-method-response-is-get-method-response', @@ -256,7 +256,7 @@ testRule('xgen-IPA-106-create-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -302,7 +302,7 @@ testRule('xgen-IPA-106-create-method-response-is-get-method-response', [ code: 'xgen-IPA-106-create-method-response-is-get-method-response', message: 'The schema in the Create method response must be the same schema as the response of the Get method.', path: ['paths', '/resources', 'post', 'responses', '201', 'content', 'application/vnd.atlas.2024-08-05+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA107UpdateMethodMustNotHaveQueryParams.test.js b/tools/spectral/ipa/__tests__/IPA107UpdateMethodMustNotHaveQueryParams.test.js index 4bc3c9318e..5219be6067 100644 --- a/tools/spectral/ipa/__tests__/IPA107UpdateMethodMustNotHaveQueryParams.test.js +++ b/tools/spectral/ipa/__tests__/IPA107UpdateMethodMustNotHaveQueryParams.test.js @@ -123,19 +123,19 @@ testRule('xgen-IPA-107-update-must-not-have-query-params', [ code: 'xgen-IPA-107-update-must-not-have-query-params', message: 'Update operations must not have query parameters. Found [filter].', path: ['paths', '/resource/{id}', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-must-not-have-query-params', message: 'Update operations must not have query parameters. Found [query-param].', path: ['paths', '/resource/{id}/singleton', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-must-not-have-query-params', message: 'Update operations must not have query parameters. Found [query-param-2].', path: ['paths', '/resource/{id}/singleton', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -259,19 +259,19 @@ testRule('xgen-IPA-107-update-must-not-have-query-params', [ code: 'xgen-IPA-107-update-must-not-have-query-params', message: 'Update operations must not have query parameters. Found [filter].', path: ['paths', '/resource/{id}', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-must-not-have-query-params', message: 'Update operations must not have query parameters. Found [query-param].', path: ['paths', '/resource/{id}/singleton', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-must-not-have-query-params', message: 'Update operations must not have query parameters. Found [query-param-2].', path: ['paths', '/resource/{id}/singleton', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsGetResponse.test.js b/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsGetResponse.test.js index bd921b4878..996cfd4593 100644 --- a/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsGetResponse.test.js +++ b/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsGetResponse.test.js @@ -436,28 +436,28 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ message: 'The request body schema properties of the Update method must match the response body schema properties of the Get method.', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', message: 'The request body schema properties of the Update method must match the response body schema properties of the Get method.', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', message: 'The request body schema properties of the Update method must match the response body schema properties of the Get method.', path: ['paths', '/resource/{id}', 'put', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', message: 'The request body schema properties of the Update method must match the response body schema properties of the Get method.', path: ['paths', '/resource/{id}', 'put', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -471,7 +471,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -485,7 +485,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -499,7 +499,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -513,7 +513,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -527,7 +527,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -541,7 +541,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -555,7 +555,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -610,7 +610,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-get-method-response', @@ -624,7 +624,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsUpdateRequestSuffixedObject.test.js b/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsUpdateRequestSuffixedObject.test.js index 28e584939c..a106346064 100644 --- a/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsUpdateRequestSuffixedObject.test.js +++ b/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestBodyIsUpdateRequestSuffixedObject.test.js @@ -162,25 +162,25 @@ testRule('xgen-IPA-107-update-method-request-body-is-update-request-suffixed-obj code: 'xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object', message: 'The schema must reference a schema with a UpdateRequest suffix.', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object', message: 'The schema must reference a schema with a UpdateRequest suffix.', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2025-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object', message: 'The schema must reference a schema with a UpdateRequest suffix.', path: ['paths', '/resource/{id}', 'put', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object', message: 'The schema must reference a schema with a UpdateRequest suffix.', path: ['paths', '/resource/{id}', 'put', 'requestBody', 'content', 'application/vnd.atlas.2025-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object', @@ -193,7 +193,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-update-request-suffixed-obj 'content', 'application/vnd.atlas.2024-08-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object', @@ -206,7 +206,7 @@ testRule('xgen-IPA-107-update-method-request-body-is-update-request-suffixed-obj 'content', 'application/vnd.atlas.2024-08-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestHasNoReadonlyFields.test.js b/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestHasNoReadonlyFields.test.js index 3e7d7cedb0..8088eeec18 100644 --- a/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestHasNoReadonlyFields.test.js +++ b/tools/spectral/ipa/__tests__/IPA107UpdateMethodRequestHasNoReadonlyFields.test.js @@ -183,28 +183,28 @@ testRule('xgen-IPA-107-update-method-request-has-no-readonly-fields', [ message: 'The Update method request object must not include input fields (readOnly properties). Found readOnly property at: id. ', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-has-no-readonly-fields', message: 'The Update method request object must not include input fields (readOnly properties). Found readOnly property at one of the inline schemas. ', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-has-no-readonly-fields', message: 'The Update method request object must not include input fields (readOnly properties). Found readOnly property at: id. ', path: ['paths', '/resource/{id}', 'put', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-has-no-readonly-fields', message: 'The Update method request object must not include input fields (readOnly properties). Found readOnly property at one of the inline schemas. ', path: ['paths', '/resource/{id}', 'put', 'requestBody', 'content', 'application/vnd.atlas.2024-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-has-no-readonly-fields', @@ -218,7 +218,7 @@ testRule('xgen-IPA-107-update-method-request-has-no-readonly-fields', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-request-has-no-readonly-fields', @@ -232,7 +232,7 @@ testRule('xgen-IPA-107-update-method-request-has-no-readonly-fields', [ 'content', 'application/vnd.atlas.2023-01-01+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -262,7 +262,7 @@ testRule('xgen-IPA-107-update-method-request-has-no-readonly-fields', [ message: 'The Update method request object must not include input fields (readOnly properties). Found readOnly property at: user.userId. ', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -292,7 +292,7 @@ testRule('xgen-IPA-107-update-method-request-has-no-readonly-fields', [ message: 'The Update method request object must not include input fields (readOnly properties). Found readOnly property at: items.items.itemId. ', path: ['paths', '/resource/{id}', 'patch', 'requestBody', 'content', 'application/vnd.atlas.2023-01-01+json'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA107UpdateMethodResponseIsGetMethodResponse.test.js b/tools/spectral/ipa/__tests__/IPA107UpdateMethodResponseIsGetMethodResponse.test.js index 13c5837aa5..5fe433a7bc 100644 --- a/tools/spectral/ipa/__tests__/IPA107UpdateMethodResponseIsGetMethodResponse.test.js +++ b/tools/spectral/ipa/__tests__/IPA107UpdateMethodResponseIsGetMethodResponse.test.js @@ -357,7 +357,7 @@ testRule('xgen-IPA-107-update-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-is-get-method-response', @@ -372,7 +372,7 @@ testRule('xgen-IPA-107-update-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-is-get-method-response', @@ -387,7 +387,7 @@ testRule('xgen-IPA-107-update-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-is-get-method-response', @@ -401,7 +401,7 @@ testRule('xgen-IPA-107-update-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-is-get-method-response', @@ -415,7 +415,7 @@ testRule('xgen-IPA-107-update-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-01-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -467,7 +467,7 @@ testRule('xgen-IPA-107-update-method-response-is-get-method-response', [ 'content', 'application/vnd.atlas.2024-08-05+json', ], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA107UpdateResponseCodeShouldBe200OK.test.js b/tools/spectral/ipa/__tests__/IPA107UpdateResponseCodeShouldBe200OK.test.js index 6477dec2fc..e672d1b4bd 100644 --- a/tools/spectral/ipa/__tests__/IPA107UpdateResponseCodeShouldBe200OK.test.js +++ b/tools/spectral/ipa/__tests__/IPA107UpdateResponseCodeShouldBe200OK.test.js @@ -77,28 +77,28 @@ testRule('xgen-IPA-107-update-method-response-code-is-200', [ message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resourceOne/{id}', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-code-is-200', message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resourceTwo/{id}', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-code-is-200', message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resourceThree/{id}', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-code-is-200', message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resource/{id}/singleton', 'put'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -223,28 +223,28 @@ testRule('xgen-IPA-107-update-method-response-code-is-200', [ message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resourceOne/{id}', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-code-is-200', message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resourceTwo/{id}', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-code-is-200', message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resourceThree/{id}', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-107-update-method-response-code-is-200', message: 'The Update method response status code should be 200 OK. This method either lacks a 200 OK response or defines a different 2xx status code.', path: ['paths', '/resource/{id}/singleton', 'patch'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA108DeleteMethod204Response.test.js b/tools/spectral/ipa/__tests__/IPA108DeleteMethod204Response.test.js index 9368bb6718..1ade944b80 100644 --- a/tools/spectral/ipa/__tests__/IPA108DeleteMethod204Response.test.js +++ b/tools/spectral/ipa/__tests__/IPA108DeleteMethod204Response.test.js @@ -35,7 +35,7 @@ testRule('xgen-IPA-108-delete-method-return-204-response', [ code: 'xgen-IPA-108-delete-method-return-204-response', message: 'DELETE method should return 204 No Content status code.', path: ['paths', '/resource/{id}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -53,7 +53,7 @@ testRule('xgen-IPA-108-delete-method-return-204-response', [ code: 'xgen-IPA-108-delete-method-return-204-response', message: 'DELETE method should return 204 No Content status code.', path: ['paths', '/resource/{id}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -77,7 +77,7 @@ testRule('xgen-IPA-108-delete-method-return-204-response', [ code: 'xgen-IPA-108-delete-method-return-204-response', message: 'DELETE method should return 204 No Content status code.', path: ['paths', '/resource/{id}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -138,7 +138,7 @@ testRule('xgen-IPA-108-delete-method-return-204-response', [ code: 'xgen-IPA-108-delete-method-return-204-response', message: 'DELETE method should return 204 No Content status code.', path: ['paths', '/resources/{resourceId}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA108DeleteMethod404Response.test.js b/tools/spectral/ipa/__tests__/IPA108DeleteMethod404Response.test.js index 1b4a1472ac..5f01135ab2 100644 --- a/tools/spectral/ipa/__tests__/IPA108DeleteMethod404Response.test.js +++ b/tools/spectral/ipa/__tests__/IPA108DeleteMethod404Response.test.js @@ -34,7 +34,7 @@ testRule('xgen-IPA-108-delete-include-404-response', [ code: 'xgen-IPA-108-delete-include-404-response', message: 'DELETE method should include 404 status code for not found resources.', path: ['paths', '/resource/{id}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -54,7 +54,7 @@ testRule('xgen-IPA-108-delete-include-404-response', [ code: 'xgen-IPA-108-delete-include-404-response', message: 'DELETE method should include 404 status code for not found resources.', path: ['paths', '/resource/{id}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -76,7 +76,7 @@ testRule('xgen-IPA-108-delete-include-404-response', [ code: 'xgen-IPA-108-delete-include-404-response', message: 'DELETE method should include 404 status code for not found resources.', path: ['paths', '/resource/{id}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -131,7 +131,7 @@ testRule('xgen-IPA-108-delete-include-404-response', [ code: 'xgen-IPA-108-delete-include-404-response', message: 'DELETE method should include 404 status code for not found resources.', path: ['paths', '/resources/{resourceId}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA108DeleteMethodNoRequestBody.test.js b/tools/spectral/ipa/__tests__/IPA108DeleteMethodNoRequestBody.test.js index 05c4552400..3177108cfb 100644 --- a/tools/spectral/ipa/__tests__/IPA108DeleteMethodNoRequestBody.test.js +++ b/tools/spectral/ipa/__tests__/IPA108DeleteMethodNoRequestBody.test.js @@ -42,7 +42,7 @@ testRule('xgen-IPA-108-delete-request-no-body', [ code: 'xgen-IPA-108-delete-request-no-body', message: 'DELETE method should not have a request body.', path: ['paths', '/resource/{id}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -109,7 +109,7 @@ testRule('xgen-IPA-108-delete-request-no-body', [ code: 'xgen-IPA-108-delete-request-no-body', message: 'DELETE method should not have a request body.', path: ['paths', '/resources/{resourceId}', 'delete'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA108DeleteMethodResponseShouldNotHaveSchema.test.js b/tools/spectral/ipa/__tests__/IPA108DeleteMethodResponseShouldNotHaveSchema.test.js index 06cb5a56a5..5eee97844b 100644 --- a/tools/spectral/ipa/__tests__/IPA108DeleteMethodResponseShouldNotHaveSchema.test.js +++ b/tools/spectral/ipa/__tests__/IPA108DeleteMethodResponseShouldNotHaveSchema.test.js @@ -67,7 +67,7 @@ testRule('xgen-IPA-108-delete-response-should-be-empty', [ message: 'Error found for application/vnd.atlas.2023-01-01+json: DELETE method should return an empty response. The response should not have a schema property.', path: ['paths', '/resource/{id}', 'delete', 'responses', '204'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, @@ -141,7 +141,7 @@ testRule('xgen-IPA-108-delete-response-should-be-empty', [ message: 'Error found for application/vnd.atlas.2023-01-01+json: DELETE method should return an empty response. The response should not have a schema property.', path: ['paths', '/resources/{resourceId}', 'delete', 'responses', '204'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA113SingletonHasNoDeleteMethod.test.js b/tools/spectral/ipa/__tests__/IPA113SingletonHasNoDeleteMethod.test.js index ebd790a9c4..8bd2d3c120 100644 --- a/tools/spectral/ipa/__tests__/IPA113SingletonHasNoDeleteMethod.test.js +++ b/tools/spectral/ipa/__tests__/IPA113SingletonHasNoDeleteMethod.test.js @@ -38,7 +38,7 @@ testRule('xgen-IPA-113-singleton-must-not-have-delete-method', [ message: 'Singleton resources must not define the Delete standard method. If this is not a singleton resource, please implement all CRUDL methods.', path: ['paths', '/resource/{exampleId}/singleton'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA113SingletonHasNoId.test.js b/tools/spectral/ipa/__tests__/IPA113SingletonHasNoId.test.js index 4770abb358..a998a17576 100644 --- a/tools/spectral/ipa/__tests__/IPA113SingletonHasNoId.test.js +++ b/tools/spectral/ipa/__tests__/IPA113SingletonHasNoId.test.js @@ -165,19 +165,19 @@ testRule('xgen-IPA-113-singleton-must-not-have-id', [ code: 'xgen-IPA-113-singleton-must-not-have-id', message: 'Singleton resources must not have a user-provided or system-generated ID.', path: ['paths', '/resource/{exampleId}/singletonOne'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-113-singleton-must-not-have-id', message: 'Singleton resources must not have a user-provided or system-generated ID.', path: ['paths', '/resource/{exampleId}/singletonTwo'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-113-singleton-must-not-have-id', message: 'Singleton resources must not have a user-provided or system-generated ID.', path: ['paths', '/resource/{exampleId}/singletonThree'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/__tests__/IPA113SingletonHasUpdateMethod.test.js b/tools/spectral/ipa/__tests__/IPA113SingletonHasUpdateMethod.test.js index ce29ed75b9..e47320cb3a 100644 --- a/tools/spectral/ipa/__tests__/IPA113SingletonHasUpdateMethod.test.js +++ b/tools/spectral/ipa/__tests__/IPA113SingletonHasUpdateMethod.test.js @@ -36,14 +36,14 @@ testRule('xgen-IPA-113-singleton-should-have-update-method', [ message: 'Singleton resources should define the Update method. If this is not a singleton resource, please implement all CRUDL methods.', path: ['paths', '/resource/{exampleId}/singletonOne'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, { code: 'xgen-IPA-113-singleton-should-have-update-method', message: 'Singleton resources should define the Update method. If this is not a singleton resource, please implement all CRUDL methods.', path: ['paths', '/resource/{exampleId}/singletonTwo'], - severity: DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Error, }, ], }, diff --git a/tools/spectral/ipa/ipa-spectral.yaml b/tools/spectral/ipa/ipa-spectral.yaml index 3bc7d2371b..97b9f24223 100644 --- a/tools/spectral/ipa/ipa-spectral.yaml +++ b/tools/spectral/ipa/ipa-spectral.yaml @@ -29,3 +29,14 @@ overrides: - '**#/components/schemas/DataLakeStoreSettings/properties/provider' rules: xgen-IPA-117-description: 'off' + - files: + - '**#/components/schemas/DataLakeAzureBlobStore' # external field, to be covered by CLOUDP-293178 + - '**#/components/schemas/AdvancedClusterDescription/properties/mongoDBEmployeeAccessGrant' # unable to document exceptions, to be covered by CLOUDP-308286 + - '**#/components/schemas/AtlasTenantClusterUpgradeRequest20240805/properties/mongoDBEmployeeAccessGrant' # unable to document exceptions, to be covered by CLOUDP-308286 + - '**#/components/schemas/ClusterDescription20240805/properties/mongoDBEmployeeAccessGrant' # unable to document exceptions, to be covered by CLOUDP-308286 + - '**#/components/schemas/LegacyAtlasCluster/properties/mongoDBEmployeeAccessGrant' # unable to document exceptions, to be covered by CLOUDP-308286 + - '**#/components/schemas/LegacyAtlasTenantClusterUpgradeRequest/properties/mongoDBEmployeeAccessGrant' # unable to document exceptions, to be covered by CLOUDP-308286 + - '**#/components/schemas/AdvancedAutoScalingSettings/properties/diskGB' # unable to document exceptions, to be covered by CLOUDP-308286 + - '**#/components/schemas/UserSecurity/properties/customerX509' # unable to document exceptions, to be covered by CLOUDP-308286 + rules: + xgen-IPA-112-field-names-are-camel-case: 'off' diff --git a/tools/spectral/ipa/rulesets/IPA-102.yaml b/tools/spectral/ipa/rulesets/IPA-102.yaml index 358cd73801..ba01041905 100644 --- a/tools/spectral/ipa/rulesets/IPA-102.yaml +++ b/tools/spectral/ipa/rulesets/IPA-102.yaml @@ -18,7 +18,7 @@ rules: - Double slashes (//) are not allowed in paths message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-102-collection-identifier-camelCase' - severity: warn + severity: error given: $.paths then: field: '@key' @@ -59,7 +59,7 @@ rules: - Each non-parameter path segment must start with a lowercase letter followed by any combination of ASCII letters and numbers message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-102-collection-identifier-pattern' - severity: warn + severity: error given: $.paths then: field: '@key' diff --git a/tools/spectral/ipa/rulesets/IPA-106.yaml b/tools/spectral/ipa/rulesets/IPA-106.yaml index 48f39e3f7d..f99a4fbf86 100644 --- a/tools/spectral/ipa/rulesets/IPA-106.yaml +++ b/tools/spectral/ipa/rulesets/IPA-106.yaml @@ -55,7 +55,7 @@ rules: - Property comparison is based on `type` and `name` matching. - `oneOf` and `discriminator` definitions must match exactly. message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-create-method-request-body-is-get-method-response:' - severity: warn + severity: error given: '$.paths[*].post.requestBody.content' then: field: '@key' @@ -103,7 +103,7 @@ rules: - Ignores resources without a Get method - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-create-method-response-is-get-method-response' - severity: warn + severity: error given: '$.paths[*].post.responses.201.content' then: field: '@key' diff --git a/tools/spectral/ipa/rulesets/IPA-107.yaml b/tools/spectral/ipa/rulesets/IPA-107.yaml index 1aca7b9f18..7e48ef340b 100644 --- a/tools/spectral/ipa/rulesets/IPA-107.yaml +++ b/tools/spectral/ipa/rulesets/IPA-107.yaml @@ -21,7 +21,7 @@ rules: - Query parameters `envelope` and `pretty` are exempt from this rule - Operation objects with `x-xgen-IPA-exception` for this rule are excluded from validation message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-update-must-not-have-query-params' - severity: warn + severity: error given: '$.paths[*][put,patch]' then: function: 'IPA107UpdateMethodMustNotHaveQueryParams' @@ -37,7 +37,7 @@ rules: - Operation objects with `x-xgen-IPA-exception` for this rule are excluded from validation message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-update-method-response-code-is-200' - severity: warn + severity: error given: '$.paths[*][put,patch]' then: function: 'IPA107UpdateResponseCodeShouldBe200OK' @@ -53,7 +53,7 @@ rules: - Fails if the Get method doesn't have a schema reference or if the schemas don't match - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-update-method-response-is-get-method-response' - severity: warn + severity: error given: '$.paths[*][put,patch].responses.200.content' then: field: '@key' @@ -69,7 +69,7 @@ rules: - Searches through the request schema to find any properties marked with readOnly attribute - Fails if any readOnly properties are found in the request schema message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-update-method-request-has-no-readonly-fields' - severity: warn + severity: error given: '$.paths[*][put,patch].requestBody.content' then: field: '@key' @@ -87,7 +87,7 @@ rules: - Property comparison is based on `type` and `name` matching. - `oneOf` and `discriminator` definitions must match exactly. message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-update-method-request-body-is-get-method-response:' - severity: warn + severity: error given: '$.paths[*][put,patch].requestBody.content' then: field: '@key' @@ -103,7 +103,7 @@ rules: - Validation only applies to schema references to a predefined schema (not inline) - Confirms the referenced schema name ends with "Request" suffix message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object' - severity: warn + severity: error given: '$.paths[*][put,patch].requestBody.content' then: field: '@key' diff --git a/tools/spectral/ipa/rulesets/IPA-108.yaml b/tools/spectral/ipa/rulesets/IPA-108.yaml index ed31e45405..ec2b2b7935 100644 --- a/tools/spectral/ipa/rulesets/IPA-108.yaml +++ b/tools/spectral/ipa/rulesets/IPA-108.yaml @@ -13,7 +13,7 @@ rules: - Fails if any content type in the response has a defined schema as reference - Skips validation for collection endpoints (without path parameters) message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-108-delete-response-should-be-empty' - severity: warn + severity: error given: $.paths[*].delete.responses[204] then: function: IPA108DeleteMethodResponseShouldNotHaveSchema @@ -31,7 +31,7 @@ rules: - Fails if the 204 status code is missing or if other 2xx responses exist - Skips validation for collection endpoints (without path parameters) message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-108-delete-method-return-204-response' - severity: warn + severity: error given: $.paths[*].delete then: function: IPA108DeleteMethod204Response @@ -47,7 +47,7 @@ rules: - Fails if the 404 status code is missing from the responses - Skips validation for collection endpoints (without path parameters) message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-108-delete-include-404-response' - severity: warn + severity: error given: $.paths[*].delete then: function: IPA108DeleteMethod404Response @@ -63,7 +63,7 @@ rules: - Fails if any requestBody is defined for the DELETE method - Skips validation for collection endpoints (without path parameters) message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-108-delete-request-no-body' - severity: warn + severity: error given: $.paths[*].delete then: function: IPA108DeleteMethodNoRequestBody diff --git a/tools/spectral/ipa/rulesets/IPA-113.yaml b/tools/spectral/ipa/rulesets/IPA-113.yaml index 8424b71d1d..ff26e2f435 100644 --- a/tools/spectral/ipa/rulesets/IPA-113.yaml +++ b/tools/spectral/ipa/rulesets/IPA-113.yaml @@ -19,7 +19,7 @@ rules: - Verifies that no schema contains 'id' or '_id' properties in their object definitions - Fails if any response schema contains these identifier properties message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-113-singleton-must-not-have-id' - severity: warn + severity: error given: '$.paths[*]' then: function: 'IPA113SingletonHasNoId' @@ -32,7 +32,7 @@ rules: - Applies only to singleton resources - Checks that the resource does not have a DELETE method defined message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-113-singleton-must-not-have-delete-method' - severity: warn + severity: error given: '$.paths[*]' then: function: 'IPA113SingletonHasNoDeleteMethod' @@ -45,7 +45,7 @@ rules: - Applies only to singleton resources - Checks that the resource has the PUT and/or PATCH methods defined message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-113-singleton-should-have-update-method' - severity: warn + severity: error given: '$.paths[*]' then: function: 'IPA113SingletonHasUpdateMethod' diff --git a/tools/spectral/ipa/rulesets/README.md b/tools/spectral/ipa/rulesets/README.md index e0e3827ce3..74115dbe3b 100644 --- a/tools/spectral/ipa/rulesets/README.md +++ b/tools/spectral/ipa/rulesets/README.md @@ -29,22 +29,9 @@ Rule checks for the following conditions: Rules are based on [http://go/ipa/IPA-102](http://go/ipa/IPA-102). -#### xgen-IPA-102-path-alternate-resource-name-path-param - - ![error](https://img.shields.io/badge/error-red) -Paths should alternate between resource names and path params. - -##### Implementation details -Rule checks for the following conditions: - - - Paths must follow a pattern where resource names and path parameters strictly alternate - - Even-indexed path segments should be resource names (not path parameters) - - Odd-indexed path segments should be path parameters - - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation - #### xgen-IPA-102-collection-identifier-camelCase - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Collection identifiers must be in camelCase. ##### Implementation details @@ -58,9 +45,22 @@ Collection identifiers must be in camelCase. - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation - Double slashes (//) are not allowed in paths +#### xgen-IPA-102-path-alternate-resource-name-path-param + + ![error](https://img.shields.io/badge/error-red) +Paths should alternate between resource names and path params. + +##### Implementation details +Rule checks for the following conditions: + + - Paths must follow a pattern where resource names and path parameters strictly alternate + - Even-indexed path segments should be resource names (not path parameters) + - Odd-indexed path segments should be path parameters + - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation + #### xgen-IPA-102-collection-identifier-pattern - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Collection identifiers must begin with a lowercase letter and contain only ASCII letters and numbers. ##### Implementation details @@ -222,6 +222,20 @@ Rule checks for the following conditions: - Verifies the operation does not contain query parameters - Ignores specified parameters like 'pretty' and 'envelope' via configuration +#### xgen-IPA-106-create-method-request-body-is-get-method-response + + ![error](https://img.shields.io/badge/error-red) +Request body content of the Create method and response content of the Get method should refer to the same resource. + +##### Implementation details + +Validation checks the POST method for resource collection paths. + - Validation ignores resources without a Get method. + - `readOnly:true` properties of Get method response will be ignored. + - `writeOnly:true` properties of Create method request will be ignored. + - Property comparison is based on `type` and `name` matching. + - `oneOf` and `discriminator` definitions must match exactly. + #### xgen-IPA-106-create-method-request-has-no-readonly-fields ![error](https://img.shields.io/badge/error-red) @@ -245,23 +259,9 @@ Rule checks for the following conditions: - Verifies the 201 Created response code is present - Fails if the method lacks a 201 Created response or defines a different 2xx status code -#### xgen-IPA-106-create-method-request-body-is-get-method-response - - ![warn](https://img.shields.io/badge/warning-yellow) -Request body content of the Create method and response content of the Get method should refer to the same resource. - -##### Implementation details - -Validation checks the POST method for resource collection paths. - - Validation ignores resources without a Get method. - - `readOnly:true` properties of Get method response will be ignored. - - `writeOnly:true` properties of Create method request will be ignored. - - Property comparison is based on `type` and `name` matching. - - `oneOf` and `discriminator` definitions must match exactly. - #### xgen-IPA-106-create-method-response-is-get-method-response - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The response body of the Create method should consist of the same resource object returned by the Get method. ##### Implementation details @@ -281,7 +281,7 @@ Rules are based on [http://go/ipa/IPA-107](http://go/ipa/IPA-107). #### xgen-IPA-107-update-must-not-have-query-params - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Update operations must not accept query parameters. ##### Implementation details Validation checks the PATCH/PUT methods for single resource paths and [singleton resources](https://go/ipa/113). @@ -290,7 +290,7 @@ Validation checks the PATCH/PUT methods for single resource paths and [singleton - Operation objects with `x-xgen-IPA-exception` for this rule are excluded from validation #### xgen-IPA-107-update-method-response-code-is-200 - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Update method response status code should be 200 OK. ##### Implementation details Validation checks the PATCH/PUT methods for single resource paths and [singleton resources](https://go/ipa/113). @@ -298,7 +298,7 @@ Validation checks the PATCH/PUT methods for single resource paths and [singleton - Operation objects with `x-xgen-IPA-exception` for this rule are excluded from validation #### xgen-IPA-107-update-method-response-is-get-method-response - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The response body of the Update method should consist of the same resource object returned by the Get method. ##### Implementation details Rule checks for the following conditions: - Applies only to single resource paths and singleton resources with JSON content types @@ -308,7 +308,7 @@ The response body of the Update method should consist of the same resource objec - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation #### xgen-IPA-107-update-method-request-has-no-readonly-fields - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Update method Request object must not include fields with readOnly:true. ##### Implementation details @@ -320,7 +320,7 @@ Rule checks for the following conditions: #### xgen-IPA-107-update-method-request-body-is-get-method-response - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The request body must contain the resource being updated, i.e. the resource or parts of the resource returned by the Get method. ##### Implementation details @@ -334,7 +334,7 @@ Validation checks the PATCH/PUT methods for single resource paths and singleton #### xgen-IPA-107-update-method-request-body-is-update-request-suffixed-object - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) The Update method request schema should reference an `UpdateRequest` suffixed object. ##### Implementation details @@ -352,7 +352,7 @@ Rules are based on [http://go/ipa/IPA-108](http://go/ipa/IPA-108). #### xgen-IPA-108-delete-response-should-be-empty - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Delete method response should not have schema reference to object. ##### Implementation details @@ -364,7 +364,7 @@ Rule checks for the following conditions: #### xgen-IPA-108-delete-method-return-204-response - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) DELETE method must return 204 No Content. ##### Implementation details @@ -378,7 +378,7 @@ Rule checks for the following conditions: #### xgen-IPA-108-delete-include-404-response - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) DELETE method must include 404 response and return it when resource not found. ##### Implementation details @@ -390,7 +390,7 @@ Rule checks for the following conditions: #### xgen-IPA-108-delete-request-no-body - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) DELETE method must not have request body. ##### Implementation details @@ -570,7 +570,7 @@ Rules are based on [http://go/ipa/IPA-113](http://go/ipa/IPA-113). #### xgen-IPA-113-singleton-must-not-have-id - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Singleton resources must not have a user-provided or system-generated ID. ##### Implementation details @@ -583,7 +583,7 @@ Rule checks for the following conditions: #### xgen-IPA-113-singleton-must-not-have-delete-method - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Singleton resources must not define the Delete standard method. ##### Implementation details @@ -593,7 +593,7 @@ Rule checks for the following conditions: #### xgen-IPA-113-singleton-should-have-update-method - ![warn](https://img.shields.io/badge/warning-yellow) + ![error](https://img.shields.io/badge/error-red) Singleton resources should define the Update method. Validation for the presence of Get method is covered by IPA-104 (see [xgen-IPA-104-resource-has-GET](https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-104-resource-has-GET)). ##### Implementation details