Skip to content

Commit

Permalink
Re-enable some rules and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markdebeer committed Dec 10, 2024
1 parent f6f84d5 commit 6646b1e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
46 changes: 22 additions & 24 deletions rulesets/src/collections.ruleset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@ rules:
# match: "object"

##### Root Element #####
# https://atlassian.spscommerce.com/browse/DPE-286
# sps-collection-missing-results-array:
# description: "Response bodies must have a root element called results and is an array of objects."
# severity: error
# given: $.paths[?([email protected](/.*\/\{[^}]+\}$/))].get.responses['200'].content.application/json.schema.properties.results
# then:
# - field: type
# function: pattern
# functionOptions:
# match: "array"
# - field: items.type
# function: pattern
# functionOptions:
# match: "object"
sps-collection-missing-results-array:
description: "Response bodies must have a root element called results and is an array of objects."
severity: error
given: $.paths[?([email protected](/.*\/\{[^}]+\}$/))].get.responses['200'].content.application/json.schema.properties.results
then:
- field: type
function: pattern
functionOptions:
match: "array"
- field: items.type
function: pattern
functionOptions:
match: "object"

##### Pagination #####
sps-missing-pagination-query-parameters:
Expand Down Expand Up @@ -66,16 +65,15 @@ rules:
in:
const: query

# sps-post-request-body-missing-paging-object:
# See https://atlassian.spscommerce.com/browse/DPE-286
# description: "POST collection endpoints MUST have a request body schema that includes paging parameters."
# severity: error
# given: $.paths[?([email protected](/.*\/\{[^}]+\}$/))].post.requestBody.content.application/json.schema.properties.paging
# then:
# field: "type"
# function: pattern
# functionOptions:
# match: "object"
sps-post-request-body-missing-paging-object:
description: "POST collection endpoints MUST have a request body schema that includes paging parameters."
severity: error
given: $.paths[?([email protected](/.*\/\{[^}]+\}$/))].post.requestBody.content.application/json.schema.properties.paging
then:
field: "type"
function: pattern
functionOptions:
match: "object"

##### FILTERING #####
sps-disallow-resource-identifier-filtering:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("sps-collection-missing-results-array", () => {
await spectral.validateSuccess(spec, ruleName);
});

test.skip("invalid - collection response - results is not an array", async () => {
test("invalid - collection response - results is not an array", async () => {
const spec = `
openapi: 3.0.0
info:
Expand All @@ -63,7 +63,7 @@ describe("sps-collection-missing-results-array", () => {
await spectral.validateFailure(spec, ruleName, "Error", 1);
});

test.skip("invalid - collection response - results is not an array of objects", async () => {
test("invalid - collection response - results is not an array of objects", async () => {
const spec = `
openapi: 3.0.0
info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("sps-post-request-body-missing-paging-object", () => {
await spectral.validateSuccess(spec, ruleName);
});

test.skip("invalid - POST endpoint has incorrect paging type - string", async () => {
test("invalid - POST endpoint has incorrect paging type - string", async () => {
const spec = `
openapi: 3.1.0
paths:
Expand Down

0 comments on commit 6646b1e

Please sign in to comment.