Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Ruleset sps-paths-no-special-characters due to Performance Issues #27

Merged
merged 2 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions rulesets/src/url-structure.ruleset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ rules:
functionOptions:
match: "^(\\/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"

sps-paths-no-special-characters:
message: "A resource MUST only contain lowercase ISO basic Latin alphabet characters, the numeric characters `0-9`, and a hyphen or dash character. Parameters must be camel cased."
severity: error
given: $.paths.*~
then:
function: pattern
functionOptions:
match: ^([0-9a-z-\/]*({[a-z][0-9a-zA-Z-]+})?)*$
# Performance issue with spectral-cli and the regex provided - https://github.com/SPSCommerce/sps-api-standards/issues/26
# sps-paths-no-special-characters:
# message: "A resource MUST only contain lowercase ISO basic Latin alphabet characters, the numeric characters `0-9`, and a hyphen or dash character. Parameters must be camel cased."
# severity: error
# given: $.paths.*~
# then:
# function: pattern
# functionOptions:
# match: ^([0-9a-z-\/]*({[a-z][0-9a-zA-Z-]+})?)*$

sps-paths-trailing-slash:
message: "A resource MUST be addressable without a trailing slash on the path."
Expand Down Expand Up @@ -193,4 +194,4 @@ rules:
functionOptions:
notMatch: \?



Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("sps-paths-no-special-characters", () => {
spectral = new SpectralTestHarness(ruleset);
});

test("succeeds with standard characters", async () => {
xtest("succeeds with standard characters", async () => {
const spec = `
openapi: 3.1.0
paths:
Expand All @@ -21,7 +21,7 @@ describe("sps-paths-no-special-characters", () => {
await spectral.validateSuccess(spec, ruleName);
});

test("succeeds with interpolation", async () => {
xtest("succeeds with interpolation", async () => {
const spec = `
openapi: 3.1.0
paths:
Expand All @@ -33,7 +33,7 @@ describe("sps-paths-no-special-characters", () => {
await spectral.validateSuccess(spec, ruleName);
});

test("fails special characters", async () => {
xtest("fails special characters", async () => {
const spec = `
openapi: 3.1.0
paths:
Expand Down