diff --git a/components/common.yaml b/components/common.yaml index 6cc20258..71965ca7 100644 --- a/components/common.yaml +++ b/components/common.yaml @@ -452,6 +452,8 @@ responses: schema: type: object nullable: true + additionalProperties: false + "400": description: "Bad Request: A parameter provided as a part of the request was invalid." diff --git a/end-end-tests/api-standards/resources/async/2024-07-22/baseline.yaml b/end-end-tests/api-standards/resources/async/2024-07-22/baseline.yaml index d7e54b3a..6e46d8f2 100644 --- a/end-end-tests/api-standards/resources/async/2024-07-22/baseline.yaml +++ b/end-end-tests/api-standards/resources/async/2024-07-22/baseline.yaml @@ -240,6 +240,7 @@ components: ThingResourceResponse: type: object description: Response containing a single thing resource object + additionalProperties: false properties: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingResource" } @@ -248,6 +249,7 @@ components: ThingCollectionResponse: type: object description: Response containing a collection of thing resource objects + additionalProperties: false properties: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingCollection" } diff --git a/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-in-reform.yaml b/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-in-reform.yaml index cb6db55e..09c80112 100644 --- a/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-in-reform.yaml +++ b/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-in-reform.yaml @@ -274,6 +274,7 @@ components: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingResource" } links: { $ref: "#/components/x-rest-common/schemas/SelfLink" } + additionalProperties: false ThingCollectionResponse: type: object @@ -282,6 +283,7 @@ components: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingCollection" } links: { $ref: "#/components/x-rest-common/schemas/PaginatedLinks" } + additionalProperties: false ThingResource: type: object diff --git a/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-meta.yaml b/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-meta.yaml index ca9d900f..3f0851e8 100644 --- a/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-meta.yaml +++ b/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline-meta.yaml @@ -229,6 +229,7 @@ components: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingResource" } links: { $ref: "#/components/x-rest-common/schemas/SelfLink" } + additionalProperties: false ThingCollectionResponse: type: object @@ -237,6 +238,7 @@ components: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingCollection" } links: { $ref: "#/components/x-rest-common/schemas/PaginatedLinks" } + additionalProperties: false ThingResource: type: object @@ -278,7 +280,6 @@ components: properties: otherCamelCase: { type: string } OtherPascalCase: { type: string } - additionalProperties: true ThingRelationships: diff --git a/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline.yaml b/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline.yaml index c9be0a52..8c3f9ce9 100644 --- a/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline.yaml +++ b/end-end-tests/api-standards/resources/thing/2021-11-10/000-baseline.yaml @@ -229,6 +229,7 @@ components: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingResource" } links: { $ref: "#/components/x-rest-common/schemas/SelfLink" } + additionalProperties: false ThingCollectionResponse: type: object @@ -237,6 +238,7 @@ components: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingCollection" } links: { $ref: "#/components/x-rest-common/schemas/PaginatedLinks" } + additionalProperties: false ThingResource: type: object diff --git a/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml b/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml index ffd87f72..90d11702 100644 --- a/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml +++ b/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml @@ -78,6 +78,8 @@ components: data: type: array items: { $ref: "#/components/schemas/ThingResourceItem" } + additionalProperties: false + ThingResourceItem: type: object description: thing resource object diff --git a/end-end-tests/api-standards/resources/thing/2021-11-10/001-fail-type-change-beta.yaml b/end-end-tests/api-standards/resources/thing/2021-11-10/001-fail-type-change-beta.yaml index 3c4006f0..a64a5a4c 100644 --- a/end-end-tests/api-standards/resources/thing/2021-11-10/001-fail-type-change-beta.yaml +++ b/end-end-tests/api-standards/resources/thing/2021-11-10/001-fail-type-change-beta.yaml @@ -225,6 +225,7 @@ components: ThingResourceResponse: type: object description: Response containing a single thing resource object + additionalProperties: false properties: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingResource" } @@ -233,6 +234,7 @@ components: ThingCollectionResponse: type: object description: Response containing a collection of thing resource objects + additionalProperties: false properties: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingCollection" } diff --git a/end-end-tests/api-standards/resources/thing/2021-11-10/001-singleton.yaml b/end-end-tests/api-standards/resources/thing/2021-11-10/001-singleton.yaml index 6e49e6ea..fb1d99ef 100644 --- a/end-end-tests/api-standards/resources/thing/2021-11-10/001-singleton.yaml +++ b/end-end-tests/api-standards/resources/thing/2021-11-10/001-singleton.yaml @@ -66,6 +66,7 @@ components: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingResource" } links: { $ref: "#/components/x-rest-common/schemas/SelfLink" } + additionalProperties: false ThingResource: type: object diff --git a/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation-beta.yaml b/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation-beta.yaml index 216dd32a..306d17b0 100644 --- a/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation-beta.yaml +++ b/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation-beta.yaml @@ -252,6 +252,7 @@ components: ThingResourceResponse: type: object description: Response containing a single thing resource object + additionalProperties: false properties: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingResource" } @@ -260,6 +261,7 @@ components: ThingCollectionResponse: type: object description: Response containing a collection of thing resource objects + additionalProperties: false properties: jsonapi: { $ref: "#/components/x-rest-common/schemas/JsonApi" } data: { $ref: "#/components/schemas/ThingCollection" } diff --git a/end-end-tests/api-standards/versions/2021-09-06~beta/spec-baseline.yaml b/end-end-tests/api-standards/versions/2021-09-06~beta/spec-baseline.yaml index 294f67b2..7a9b4a0a 100644 --- a/end-end-tests/api-standards/versions/2021-09-06~beta/spec-baseline.yaml +++ b/end-end-tests/api-standards/versions/2021-09-06~beta/spec-baseline.yaml @@ -239,6 +239,7 @@ components: description: Resolved API version pattern: ^((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?)$ type: string + additionalProperties: false Error: additionalProperties: false example: @@ -340,22 +341,23 @@ components: LinkProperty: example: https://example.com/api/resource oneOf: - - description: A string containing the link’s URL. - example: https://example.com/api/resource - type: string - - additionalProperties: false - example: - href: https://example.com/api/resource - properties: - href: - description: A string containing the link’s URL. - example: https://example.com/api/resource - type: string - meta: - $ref: "#/components/schemas/Meta" - required: - - href - type: object + - description: A string containing the link’s URL. + example: https://example.com/api/resource + type: string + - additionalProperties: false + example: + href: https://example.com/api/resource + properties: + href: + description: A string containing the link’s URL. + example: https://example.com/api/resource + type: string + meta: + $ref: '#/components/schemas/Meta' + required: + - href + type: object + additionalProperties: false Links: additionalProperties: false properties: @@ -387,6 +389,7 @@ components: description: Requested API version pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$ type: string + additionalProperties: false SelfLink: additionalProperties: false example: @@ -528,6 +531,7 @@ paths: application/json: schema: type: object + additionalProperties: false description: OpenAPI specification matching requested version is returned headers: snyk-request-id: diff --git a/end-end-tests/api-standards/versions/2021-09-06~experimental/spec-baseline.yaml b/end-end-tests/api-standards/versions/2021-09-06~experimental/spec-baseline.yaml index 3ac158a2..fe63198a 100644 --- a/end-end-tests/api-standards/versions/2021-09-06~experimental/spec-baseline.yaml +++ b/end-end-tests/api-standards/versions/2021-09-06~experimental/spec-baseline.yaml @@ -528,6 +528,7 @@ paths: application/json: schema: type: object + additionalProperties: false description: OpenAPI specification matching requested version is returned headers: snyk-request-id: diff --git a/src/rulesets/rest/2022-05-25/__tests__/__snapshots__/end-end.test.ts.snap b/src/rulesets/rest/2022-05-25/__tests__/__snapshots__/end-end.test.ts.snap index e7c8df7b..777eb664 100644 --- a/src/rulesets/rest/2022-05-25/__tests__/__snapshots__/end-end.test.ts.snap +++ b/src/rulesets/rest/2022-05-25/__tests__/__snapshots__/end-end.test.ts.snap @@ -502,6 +502,30 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos/{repoId} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 78, + "endPosition": 2721, + "filePath": "/end-end-tests/api-standards/resources/repos/2022-04-04/spec.yaml", + "preview": "", + "startLine": 54, + "startPosition": 1687, + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos/{repoId} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -2514,6 +2538,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos/{repoId} response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos/{repoId} response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -4394,6 +4438,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos/{repoId} response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos/{repoId} response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -6274,6 +6338,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos/{repoId} response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos/{repoId} response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -8154,6 +8238,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos/{repoId} response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos/{repoId} response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -10034,6 +10138,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos/{repoId} response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos/{repoId} response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -11914,6 +12038,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos/{repoId} response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos/{repoId} response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -14458,6 +14602,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "DELETE /orgs/{orgId}/repos/{repoId} response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{orgId}/repos/{repoId} response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -16338,6 +16502,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "DELETE /orgs/{orgId}/repos/{repoId} response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{orgId}/repos/{repoId} response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -18218,6 +18402,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "DELETE /orgs/{orgId}/repos/{repoId} response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{orgId}/repos/{repoId} response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -20098,6 +20302,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "DELETE /orgs/{orgId}/repos/{repoId} response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{orgId}/repos/{repoId} response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -21978,6 +22202,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "DELETE /orgs/{orgId}/repos/{repoId} response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{orgId}/repos/{repoId} response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -23858,6 +24102,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "DELETE /orgs/{orgId}/repos/{repoId} response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{orgId}/repos/{repoId} response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -27109,14 +27373,14 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = { "change": null, "condition": undefined, - "docsLink": "https://jsonapi.org/format/#document-resource-objects", - "error": undefined, + "docsLink": undefined, + "error": "New endpoints must set additionalProperties to false in response schemas", "exempted": false, "expected": undefined, "isMust": true, "isShould": false, - "name": "include JSON:API data property for 2xx status codes", - "passed": true, + "name": "additional properties", + "passed": false, "received": undefined, "severity": 2, "sourcemap": { @@ -27127,7 +27391,7 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "startLine": 165, "startPosition": 5744, }, - "type": "added", + "type": "requirement", "where": "GET /orgs/{orgId}/repos response 200 response body: application/vnd.api+json", }, { @@ -27139,7 +27403,31 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "expected": undefined, "isMust": true, "isShould": false, - "name": "self links", + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 190, + "endPosition": 6794, + "filePath": "/end-end-tests/api-standards/resources/repos/2022-04-04/spec.yaml", + "preview": "", + "startLine": 165, + "startPosition": 5744, + }, + "type": "added", + "where": "GET /orgs/{orgId}/repos response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "self links", "passed": true, "received": undefined, "severity": 2, @@ -29118,6 +29406,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -30998,6 +31306,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -32878,6 +33206,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -34758,6 +35106,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -36638,6 +37006,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -38518,6 +38906,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "GET /orgs/{orgId}/repos response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{orgId}/repos response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -39777,6 +40185,30 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "POST /orgs/{orgId}/repos response 201 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 278, + "endPosition": 10050, + "filePath": "/end-end-tests/api-standards/resources/repos/2022-04-04/spec.yaml", + "preview": "", + "startLine": 254, + "startPosition": 9016, + }, + "type": "requirement", + "where": "POST /orgs/{orgId}/repos response 201 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -41809,6 +42241,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "POST /orgs/{orgId}/repos response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{orgId}/repos response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -43689,6 +44141,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "POST /orgs/{orgId}/repos response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{orgId}/repos response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -45569,6 +46041,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "POST /orgs/{orgId}/repos response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{orgId}/repos response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -47449,6 +47941,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "POST /orgs/{orgId}/repos response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{orgId}/repos response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -49329,6 +49841,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "POST /orgs/{orgId}/repos response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{orgId}/repos response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -51209,6 +51741,26 @@ exports[`end-end-tests fails for the right reason with invalid parameters 1`] = "type": "requirement", "where": "POST /orgs/{orgId}/repos response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{orgId}/repos response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -71699,6 +72251,102 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 122, + "endPosition": 4841, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 121, + "startPosition": 4737, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 122, + "endPosition": 4841, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 121, + "startPosition": 4737, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://github.com/snyk/sweater-comb/blob/main/docs/principles/jsonapi.md#pagination-parameters", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "pagination links", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 122, + "endPosition": 4841, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 121, + "startPosition": 4737, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 122, + "endPosition": 4841, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 121, + "startPosition": 4737, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -77079,6 +77727,78 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 78, + "endPosition": 2888, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 77, + "startPosition": 2786, + }, + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 78, + "endPosition": 2888, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 77, + "startPosition": 2786, + }, + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 78, + "endPosition": 2888, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 77, + "startPosition": 2786, + }, + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -83687,6 +84407,78 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 191, + "endPosition": 7690, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 190, + "startPosition": 7588, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 191, + "endPosition": 7690, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 190, + "startPosition": 7588, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 191, + "endPosition": 7690, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 190, + "startPosition": 7588, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -87211,6 +88003,102 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#crud-updating-responses", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response data for patch", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 232, + "endPosition": 9422, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 231, + "startPosition": 9320, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API type property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 232, + "endPosition": 9422, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 231, + "startPosition": 9320, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid patch response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 232, + "endPosition": 9422, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 231, + "startPosition": 9320, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 232, + "endPosition": 9422, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 231, + "startPosition": 9320, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -98903,6 +99791,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2 response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2 response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -100783,6 +101691,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2 response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2 response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -102663,6 +103591,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2 response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2 response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -104543,6 +105491,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2 response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2 response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -106423,6 +107391,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2 response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2 response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -109259,6 +110247,30 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing2 response 201 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": "New endpoints must set additionalProperties to false in response schemas", + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": false, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 323, + "endPosition": 13406, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 322, + "startPosition": 13304, + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing2 response 201 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -111271,6 +112283,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing2 response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing2 response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -113151,6 +114183,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing2 response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing2 response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -115031,6 +116083,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing2 response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing2 response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -116911,6 +117983,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing2 response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing2 response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -118791,6 +119883,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing2 response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing2 response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -120671,6 +121783,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing2 response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing2 response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -123419,6 +124551,30 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2/{thing_id} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": "New endpoints must set additionalProperties to false in response schemas", + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": false, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 413, + "endPosition": 17414, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 410, + "startPosition": 17135, + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2/{thing_id} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -125407,6 +126563,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2/{thing_id} response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2/{thing_id} response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -127287,6 +128463,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2/{thing_id} response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2/{thing_id} response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -129167,6 +130363,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2/{thing_id} response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2/{thing_id} response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -131047,6 +132263,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2/{thing_id} response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2/{thing_id} response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -132927,6 +134163,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing2/{thing_id} response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "GET /orgs/{org_id}/thing2/{thing_id} response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -133563,6 +134819,30 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 455, + "endPosition": 19132, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 454, + "startPosition": 19082, + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -136195,6 +137475,30 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 204 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": "New endpoints must set additionalProperties to false in response schemas", + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": false, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 480, + "endPosition": 20180, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/003-jsonapi.yaml", + "preview": "", + "startLine": 479, + "startPosition": 20078, + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 204 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -138039,6 +139343,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -139919,6 +141243,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -141799,6 +143143,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -143679,6 +145043,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -145559,6 +146943,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -147439,6 +148843,26 @@ exports[`end-end-tests fails when it doesn't meet JSON:API rules 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing2/{thing_id} response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -165211,8 +166635,8 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 118, - "endPosition": 3951, + "endLine": 120, + "endPosition": 3986, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", "startLine": 1, @@ -165235,8 +166659,8 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 118, - "endPosition": 3951, + "endLine": 120, + "endPosition": 3986, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", "startLine": 1, @@ -165259,8 +166683,8 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 118, - "endPosition": 3951, + "endLine": 120, + "endPosition": 3986, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", "startLine": 1, @@ -165283,8 +166707,8 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 118, - "endPosition": 3951, + "endLine": 120, + "endPosition": 3986, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", "startLine": 1, @@ -165680,12 +167104,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 117, - "endPosition": 3950, + "endLine": 119, + "endPosition": 3985, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 96, - "startPosition": 3203, + "startLine": 98, + "startPosition": 3238, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes", @@ -165703,12 +167127,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 102, - "endPosition": 3373, + "endLine": 104, + "endPosition": 3408, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 99, - "startPosition": 3265, + "startLine": 101, + "startPosition": 3300, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/name", @@ -165726,12 +167150,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 107, - "endPosition": 3557, + "endLine": 109, + "endPosition": 3592, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 103, - "startPosition": 3382, + "startLine": 105, + "startPosition": 3417, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/created", @@ -165749,12 +167173,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 112, - "endPosition": 3746, + "endLine": 114, + "endPosition": 3781, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 108, - "startPosition": 3566, + "startLine": 110, + "startPosition": 3601, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/updated", @@ -165772,12 +167196,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 116, - "endPosition": 3916, + "endLine": 118, + "endPosition": 3951, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 113, - "startPosition": 3755, + "startLine": 115, + "startPosition": 3790, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/description", @@ -165795,12 +167219,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 94, - "endPosition": 3197, + "endLine": 96, + "endPosition": 3232, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 90, - "startPosition": 3030, + "startLine": 92, + "startPosition": 3065, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/relationships", @@ -166051,12 +167475,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 117, - "endPosition": 3950, + "endLine": 119, + "endPosition": 3985, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 96, - "startPosition": 3203, + "startLine": 98, + "startPosition": 3238, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes", @@ -166074,12 +167498,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 102, - "endPosition": 3373, + "endLine": 104, + "endPosition": 3408, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 99, - "startPosition": 3265, + "startLine": 101, + "startPosition": 3300, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/name", @@ -166097,12 +167521,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 107, - "endPosition": 3557, + "endLine": 109, + "endPosition": 3592, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 103, - "startPosition": 3382, + "startLine": 105, + "startPosition": 3417, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/created", @@ -166120,12 +167544,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 112, - "endPosition": 3746, + "endLine": 114, + "endPosition": 3781, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 108, - "startPosition": 3566, + "startLine": 110, + "startPosition": 3601, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/updated", @@ -166143,12 +167567,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 116, - "endPosition": 3916, + "endLine": 118, + "endPosition": 3951, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 113, - "startPosition": 3755, + "startLine": 115, + "startPosition": 3790, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/description", @@ -166166,12 +167590,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 94, - "endPosition": 3197, + "endLine": 96, + "endPosition": 3232, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 90, - "startPosition": 3030, + "startLine": 92, + "startPosition": 3065, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/relationships", @@ -166422,12 +167846,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 117, - "endPosition": 3950, + "endLine": 119, + "endPosition": 3985, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 96, - "startPosition": 3203, + "startLine": 98, + "startPosition": 3238, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes", @@ -166445,12 +167869,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 102, - "endPosition": 3373, + "endLine": 104, + "endPosition": 3408, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 99, - "startPosition": 3265, + "startLine": 101, + "startPosition": 3300, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/name", @@ -166468,12 +167892,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 107, - "endPosition": 3557, + "endLine": 109, + "endPosition": 3592, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 103, - "startPosition": 3382, + "startLine": 105, + "startPosition": 3417, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/created", @@ -166491,12 +167915,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 112, - "endPosition": 3746, + "endLine": 114, + "endPosition": 3781, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 108, - "startPosition": 3566, + "startLine": 110, + "startPosition": 3601, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/updated", @@ -166514,12 +167938,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 116, - "endPosition": 3916, + "endLine": 118, + "endPosition": 3951, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 113, - "startPosition": 3755, + "startLine": 115, + "startPosition": 3790, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/description", @@ -166537,12 +167961,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 94, - "endPosition": 3197, + "endLine": 96, + "endPosition": 3232, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 90, - "startPosition": 3030, + "startLine": 92, + "startPosition": 3065, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/relationships", @@ -166793,12 +168217,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 117, - "endPosition": 3950, + "endLine": 119, + "endPosition": 3985, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 96, - "startPosition": 3203, + "startLine": 98, + "startPosition": 3238, }, "type": "requirement", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes", @@ -166816,12 +168240,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 102, - "endPosition": 3373, + "endLine": 104, + "endPosition": 3408, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 99, - "startPosition": 3265, + "startLine": 101, + "startPosition": 3300, }, "type": "requirement", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/name", @@ -166839,12 +168263,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 107, - "endPosition": 3557, + "endLine": 109, + "endPosition": 3592, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 103, - "startPosition": 3382, + "startLine": 105, + "startPosition": 3417, }, "type": "requirement", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/created", @@ -166862,12 +168286,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 112, - "endPosition": 3746, + "endLine": 114, + "endPosition": 3781, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 108, - "startPosition": 3566, + "startLine": 110, + "startPosition": 3601, }, "type": "requirement", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/updated", @@ -166885,12 +168309,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 116, - "endPosition": 3916, + "endLine": 118, + "endPosition": 3951, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 113, - "startPosition": 3755, + "startLine": 115, + "startPosition": 3790, }, "type": "requirement", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/description", @@ -166908,12 +168332,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 94, - "endPosition": 3197, + "endLine": 96, + "endPosition": 3232, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 90, - "startPosition": 3030, + "startLine": 92, + "startPosition": 3065, }, "type": "requirement", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/relationships", @@ -167164,12 +168588,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 117, - "endPosition": 3950, + "endLine": 119, + "endPosition": 3985, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 96, - "startPosition": 3203, + "startLine": 98, + "startPosition": 3238, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes", @@ -167187,12 +168611,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 102, - "endPosition": 3373, + "endLine": 104, + "endPosition": 3408, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 99, - "startPosition": 3265, + "startLine": 101, + "startPosition": 3300, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/name", @@ -167210,12 +168634,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 107, - "endPosition": 3557, + "endLine": 109, + "endPosition": 3592, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 103, - "startPosition": 3382, + "startLine": 105, + "startPosition": 3417, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/created", @@ -167233,12 +168657,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 112, - "endPosition": 3746, + "endLine": 114, + "endPosition": 3781, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 108, - "startPosition": 3566, + "startLine": 110, + "startPosition": 3601, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/updated", @@ -167256,12 +168680,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 116, - "endPosition": 3916, + "endLine": 118, + "endPosition": 3951, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 113, - "startPosition": 3755, + "startLine": 115, + "startPosition": 3790, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/attributes/description", @@ -167279,12 +168703,12 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 94, - "endPosition": 3197, + "endLine": 96, + "endPosition": 3232, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/000-batch-post.yaml", "preview": "", - "startLine": 90, - "startPosition": 3030, + "startLine": 92, + "startPosition": 3065, }, "type": "added", "where": "POST /orgs/{org_id}/thing request body: application/vnd.api+json property: data/items/relationships", @@ -169392,6 +170816,26 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -171272,6 +172716,26 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -173152,6 +174616,26 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -175032,6 +176516,26 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -176912,6 +178416,26 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -178792,6 +180316,26 @@ exports[`end-end-tests passes valid bulk POST operation 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -180293,6 +181837,102 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3819, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3715, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3819, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3715, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://github.com/snyk/sweater-comb/blob/main/docs/principles/jsonapi.md#pagination-parameters", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "pagination links", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3819, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3715, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3819, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3715, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -183723,27 +185363,99 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "startPosition": 2540, }, "type": "requirement", - "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property data/relationships/example/meta", - }, - { - "change": null, - "condition": undefined, - "docsLink": undefined, - "error": undefined, - "exempted": false, - "expected": undefined, - "isMust": true, - "isShould": false, - "name": "response array with items", - "passed": true, - "received": undefined, - "severity": 2, - "sourcemap": { - "filePath": undefined, - "preview": "", - }, - "type": "requirement", - "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property data/relationships/example/meta", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 81, + "endPosition": 2536, + "filePath": "/components/common.yaml", + "preview": "", + "startLine": 65, + "startPosition": 1961, + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links/self", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 75, + "endPosition": 2314, + "filePath": "/components/common.yaml", + "preview": "", + "startLine": 72, + "startPosition": 2167, + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links/self/href", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 92, + "endPosition": 2801, + "filePath": "/components/common.yaml", + "preview": "", + "startLine": 83, + "startPosition": 2540, + }, + "type": "requirement", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links/self/meta", }, { "change": null, @@ -183759,15 +185471,15 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "endLine": 81, - "endPosition": 2536, - "filePath": "/components/common.yaml", + "endLine": 290, + "endPosition": 11369, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 65, - "startPosition": 1961, + "startLine": 287, + "startPosition": 11216, }, "type": "requirement", - "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links/self", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property data/attributes/strangeness", }, { "change": null, @@ -183778,20 +185490,20 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "expected": undefined, "isMust": true, "isShould": false, - "name": "response array with items", + "name": "valid collection type in response property", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 75, - "endPosition": 2314, - "filePath": "/components/common.yaml", + "endLine": 290, + "endPosition": 11369, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 72, - "startPosition": 2167, + "startLine": 287, + "startPosition": 11216, }, - "type": "requirement", - "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links/self/href", + "type": "added", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property data/attributes/strangeness", }, { "change": null, @@ -183802,68 +185514,68 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "expected": undefined, "isMust": true, "isShould": false, - "name": "response array with items", + "name": "response schema properties", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 92, - "endPosition": 2801, - "filePath": "/components/common.yaml", + "endLine": 53, + "endPosition": 1866, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 83, - "startPosition": 2540, + "startLine": 52, + "startPosition": 1764, }, "type": "requirement", - "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property links/self/meta", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", }, { "change": null, "condition": undefined, - "docsLink": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", "error": undefined, "exempted": false, "expected": undefined, "isMust": true, "isShould": false, - "name": "response array with items", + "name": "include JSON:API data property for 2xx status codes", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 290, - "endPosition": 11369, + "endLine": 53, + "endPosition": 1866, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 287, - "startPosition": 11216, + "startLine": 52, + "startPosition": 1764, }, - "type": "requirement", - "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property data/attributes/strangeness", + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", }, { "change": null, "condition": undefined, - "docsLink": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", "error": undefined, "exempted": false, "expected": undefined, "isMust": true, "isShould": false, - "name": "valid collection type in response property", + "name": "valid get / post response data schema", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 290, - "endPosition": 11369, + "endLine": 53, + "endPosition": 1866, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 287, - "startPosition": 11216, + "startLine": 52, + "startPosition": 1764, }, - "type": "added", - "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json property data/attributes/strangeness", + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", }, { "change": null, @@ -183874,7 +185586,7 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "expected": undefined, "isMust": true, "isShould": false, - "name": "response schema properties", + "name": "disallow compound documents", "passed": true, "received": undefined, "severity": 2, @@ -183886,7 +185598,7 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "startLine": 52, "startPosition": 1764, }, - "type": "requirement", + "type": "changed", "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", }, { @@ -188033,6 +189745,78 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 139, + "endPosition": 5574, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", + "preview": "", + "startLine": 138, + "startPosition": 5472, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 139, + "endPosition": 5574, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", + "preview": "", + "startLine": 138, + "startPosition": 5472, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 139, + "endPosition": 5574, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", + "preview": "", + "startLine": 138, + "startPosition": 5472, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -191487,7 +193271,99 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "startPosition": 2540, }, "type": "requirement", - "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property data/relationships/example/meta", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property data/relationships/example/meta", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 81, + "endPosition": 2536, + "filePath": "/components/common.yaml", + "preview": "", + "startLine": 65, + "startPosition": 1961, + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links/self", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 75, + "endPosition": 2314, + "filePath": "/components/common.yaml", + "preview": "", + "startLine": 72, + "startPosition": 2167, + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links/self/href", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response array with items", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 92, + "endPosition": 2801, + "filePath": "/components/common.yaml", + "preview": "", + "startLine": 83, + "startPosition": 2540, + }, + "type": "requirement", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links/self/meta", }, { "change": null, @@ -191503,11 +193379,15 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "received": undefined, "severity": 2, "sourcemap": { - "filePath": undefined, + "endLine": 290, + "endPosition": 11369, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", + "startLine": 287, + "startPosition": 11216, }, "type": "requirement", - "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property data/attributes/strangeness", }, { "change": null, @@ -191518,20 +193398,20 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "expected": undefined, "isMust": true, "isShould": false, - "name": "response array with items", + "name": "valid collection type in response property", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 81, - "endPosition": 2536, - "filePath": "/components/common.yaml", + "endLine": 290, + "endPosition": 11369, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 65, - "startPosition": 1961, + "startLine": 287, + "startPosition": 11216, }, - "type": "requirement", - "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links/self", + "type": "added", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property data/attributes/strangeness", }, { "change": null, @@ -191542,92 +193422,92 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "expected": undefined, "isMust": true, "isShould": false, - "name": "response array with items", + "name": "response schema properties", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 75, - "endPosition": 2314, - "filePath": "/components/common.yaml", + "endLine": 180, + "endPosition": 7306, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 72, - "startPosition": 2167, + "startLine": 179, + "startPosition": 7204, }, "type": "requirement", - "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links/self/href", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, { "change": null, "condition": undefined, - "docsLink": undefined, + "docsLink": "https://jsonapi.org/format/#crud-updating-responses", "error": undefined, "exempted": false, "expected": undefined, "isMust": true, "isShould": false, - "name": "response array with items", + "name": "response data for patch", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 92, - "endPosition": 2801, - "filePath": "/components/common.yaml", + "endLine": 180, + "endPosition": 7306, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 83, - "startPosition": 2540, + "startLine": 179, + "startPosition": 7204, }, - "type": "requirement", - "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property links/self/meta", + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, { "change": null, "condition": undefined, - "docsLink": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", "error": undefined, "exempted": false, "expected": undefined, "isMust": true, "isShould": false, - "name": "response array with items", + "name": "include JSON:API type property for 2xx status codes", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 290, - "endPosition": 11369, + "endLine": 180, + "endPosition": 7306, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 287, - "startPosition": 11216, + "startLine": 179, + "startPosition": 7204, }, - "type": "requirement", - "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property data/attributes/strangeness", + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, { "change": null, "condition": undefined, - "docsLink": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", "error": undefined, "exempted": false, "expected": undefined, "isMust": true, "isShould": false, - "name": "valid collection type in response property", + "name": "valid patch response data schema", "passed": true, "received": undefined, "severity": 2, "sourcemap": { - "endLine": 290, - "endPosition": 11369, + "endLine": 180, + "endPosition": 7306, "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/001-ok-add-property-field.yaml", "preview": "", - "startLine": 287, - "startPosition": 11216, + "startLine": 179, + "startPosition": 7204, }, - "type": "added", - "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json property data/attributes/strangeness", + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, { "change": null, @@ -191638,7 +193518,7 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "expected": undefined, "isMust": true, "isShould": false, - "name": "response schema properties", + "name": "disallow compound documents", "passed": true, "received": undefined, "severity": 2, @@ -191650,7 +193530,7 @@ exports[`end-end-tests passes when property field added to response 1`] = ` "startLine": 179, "startPosition": 7204, }, - "type": "requirement", + "type": "changed", "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, { @@ -199714,6 +201594,102 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3792, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3688, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3792, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3688, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://github.com/snyk/sweater-comb/blob/main/docs/principles/jsonapi.md#pagination-parameters", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "pagination links", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3792, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3688, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 97, + "endPosition": 3792, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 96, + "startPosition": 3688, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -203310,6 +205286,78 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 53, + "endPosition": 1839, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 52, + "startPosition": 1737, + }, + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 53, + "endPosition": 1839, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 52, + "startPosition": 1737, + }, + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 53, + "endPosition": 1839, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 52, + "startPosition": 1737, + }, + "type": "changed", + "where": "POST /orgs/{org_id}/thing response 201 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -207454,6 +209502,78 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API data property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 164, + "endPosition": 6586, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 163, + "startPosition": 6484, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid get / post response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 164, + "endPosition": 6586, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 163, + "startPosition": 6484, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 164, + "endPosition": 6586, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 163, + "startPosition": 6484, + }, + "type": "changed", + "where": "GET /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -211074,6 +213194,102 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#crud-updating-responses", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "response data for patch", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 205, + "endPosition": 8318, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 204, + "startPosition": 8216, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "include JSON:API type property for 2xx status codes", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 205, + "endPosition": 8318, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 204, + "startPosition": 8216, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": "https://jsonapi.org/format/#document-resource-objects", + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "valid patch response data schema", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 205, + "endPosition": 8318, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 204, + "startPosition": 8216, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "disallow compound documents", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "endLine": 205, + "endPosition": 8318, + "filePath": "/end-end-tests/api-standards/resources/thing/2021-11-10/002-ok-add-operation.yaml", + "preview": "", + "startLine": 204, + "startPosition": 8216, + }, + "type": "changed", + "where": "PATCH /orgs/{org_id}/thing/{thing_id} response 200 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -220154,6 +222370,26 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "DELETE /orgs/{org_id}/thing response 400 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{org_id}/thing response 400 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -222034,6 +224270,26 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "DELETE /orgs/{org_id}/thing response 401 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{org_id}/thing response 401 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -223914,6 +226170,26 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "DELETE /orgs/{org_id}/thing response 403 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{org_id}/thing response 403 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -225794,6 +228070,26 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "DELETE /orgs/{org_id}/thing response 404 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{org_id}/thing response 404 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -227674,6 +229970,26 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "DELETE /orgs/{org_id}/thing response 409 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{org_id}/thing response 409 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, @@ -229554,6 +231870,26 @@ exports[`end-end-tests passes when property operation added 1`] = ` "type": "requirement", "where": "DELETE /orgs/{org_id}/thing response 500 response body: application/vnd.api+json", }, + { + "change": null, + "condition": undefined, + "docsLink": undefined, + "error": undefined, + "exempted": false, + "expected": undefined, + "isMust": true, + "isShould": false, + "name": "additional properties", + "passed": true, + "received": undefined, + "severity": 2, + "sourcemap": { + "filePath": undefined, + "preview": "", + }, + "type": "requirement", + "where": "DELETE /orgs/{org_id}/thing response 500 response body: application/vnd.api+json", + }, { "change": null, "condition": undefined, diff --git a/src/rulesets/rest/2022-05-25/__tests__/property-rules.test.ts b/src/rulesets/rest/2022-05-25/__tests__/property-rules.test.ts index 85bfe433..da4c7ead 100644 --- a/src/rulesets/rest/2022-05-25/__tests__/property-rules.test.ts +++ b/src/rulesets/rest/2022-05-25/__tests__/property-rules.test.ts @@ -457,6 +457,7 @@ describe("body properties", () => { "application/json": { schema: { type: "object", + additionalProperties: false, properties: { tested_at: { type: "string", format: "date-time" }, }, @@ -471,6 +472,7 @@ describe("body properties", () => { "application/json": { schema: { type: "object", + additionalProperties: false, properties: {}, }, }, @@ -1467,4 +1469,149 @@ describe("body properties", () => { expect(results).toMatchSnapshot(); }); }); + + describe("disallowAdditionalPropertiesResponse", () => { + test("fails when additionalProperties is not set to false for new endpoints", async () => { + const ruleRunner = new RuleRunner([propertyRules]); + + const beforeSpec: OpenAPIV3.Document = { + ...baseOpenAPI, + paths: {}, + }; + + const afterSpec: OpenAPIV3.Document = { + ...baseOpenAPI, + paths: { + "/example": { + get: { + responses: { + "200": { + description: "A response from a new endpoint", + content: { + "application/json": { + schema: { + type: "object", + properties: { + invalid_property: { type: "string" }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }; + + const ruleInputs = { + ...TestHelpers.createRuleInputs(beforeSpec, afterSpec), + context: { + ...context, + operation: { + change: "added", + }, + custom: { + changeVersion: { + stability: "stable", + }, + }, + }, + }; + + const results = await ruleRunner.runRulesWithFacts(ruleInputs); + + const hasError = results.some((result) => + result.error?.includes( + "New endpoints must set additionalProperties to false in response schemas", + ), + ); + + expect(hasError).toBe(true); + }); + + test("passes when additionalProperties is set to false for new endpoints", async () => { + const ruleRunner = new RuleRunner([propertyRules]); + + const afterSpec: OpenAPIV3.Document = { + ...baseOpenAPI, + paths: { + "/example": { + get: { + responses: { + "200": { + description: "", + content: { + "application/json": { + schema: { + type: "object", + additionalProperties: false, + properties: { + valid_property: { type: "string" }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }; + + const ruleInputs = { + ...TestHelpers.createRuleInputs(baseOpenAPI, afterSpec), + context: { + ...context, + operation: { + change: "added", + }, + }, + }; + const results = await ruleRunner.runRulesWithFacts(ruleInputs); + + expect(results.length).toBeGreaterThan(0); + expect(results.every((result) => result.passed)).toBe(true); + }); + + test("does nothing when additionalProperties is set to false for existing endpoints", async () => { + const ruleRunner = new RuleRunner([propertyRules]); + + const afterSpec: OpenAPIV3.Document = { + ...baseOpenAPI, + paths: { + "/example": { + get: { + responses: { + "200": { + description: "", + content: { + "application/json": { + schema: { + type: "object", + additionalProperties: false, + properties: { + valid_property: { type: "string" }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }; + + const ruleInputs = { + ...TestHelpers.createRuleInputs(baseOpenAPI, afterSpec), + context, + }; + + const results = await ruleRunner.runRulesWithFacts(ruleInputs); + + expect(results.length).toBeGreaterThan(0); + expect(results.every((result) => result.passed)).toBe(true); + }); + }); }); diff --git a/src/rulesets/rest/2022-05-25/property-rules.ts b/src/rulesets/rest/2022-05-25/property-rules.ts index b0e936d3..ac7fa95d 100644 --- a/src/rulesets/rest/2022-05-25/property-rules.ts +++ b/src/rulesets/rest/2022-05-25/property-rules.ts @@ -102,6 +102,29 @@ const responsePropertyRemovalCompiled = new ResponseBodyRule({ !isCompiledOperationSunsetAllowed(ruleContext), }); +const disallowAdditionalPropertiesResponse = new ResponseBodyRule({ + name: "additional properties", + matches: (_, ruleContext) => ruleContext.operation.change === "added", + rule: (responseAssertions) => { + responseAssertions.body.requirement( + "set additionalProperties to false", + (body) => { + const schema = body.raw.schema as OpenAPIV3.SchemaObject; + if ( + schema.type === "object" && + schema.additionalProperties !== false && + schema.additionalProperties !== true + ) { + throw new RuleError({ + message: + "New endpoints must set additionalProperties to false in response schemas", + }); + } + }, + ); + }, +}); + const requiredRequestProperties = new RequestRule({ name: "prevent adding a required request property", docsLink: links.versioning.breakingChanges, @@ -489,6 +512,7 @@ export const propertyRulesResource = new Ruleset({ collectionTypeValidResponse, requiredPropertiesDeclaredInRequestBody, requiredPropertiesDeclaredInResponse, + disallowAdditionalPropertiesResponse, ], }); @@ -515,5 +539,6 @@ export const propertyRulesCompiled = new Ruleset({ collectionTypeValidResponse, requiredPropertiesDeclaredInRequestBody, requiredPropertiesDeclaredInResponse, + disallowAdditionalPropertiesResponse, ], });