You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-]+})?)*$
The Spectral CLI seems to hang on failing matches of longer paths. It looks like it eventually will complete but is a performance issue or leak that results in the linting going from 2 seconds to over 60+ minutes.
The following is a simplified example to reproduce:
Spectral Ruleset:
--- .spectral.yml
extends:
- spectral:oas
rules:
recommended-path-characters-only:
message: "A resource MUST only contain lowercase ISO basic Latin alphabet characters..."
severity: error
given: $.paths.*~
then:
function: pattern
functionOptions:
match: '^(\/([0-9a-z-]+|({[0-9a-zA-Z-]+})+)*)+$'
OpenAPI Spec:
--- oas.json
{
"openapi": "3.0.3",
"info": {
"title": "My API",
"description": "My API Description"
},
"paths": {
"/v1/api/project-retailer/thinking-very-long/{my_test}": {
}
}
}
Local execution (with node 16.14.0 and Spectral 6.4.2 (latest at time of writing)):
By modifying the path to pass the regex, it passes instantly: /v1/api/project-retailer/thinking-very-long/{myTest} or even shortening the path works instantly as well: /v1/{my_test}.
Small Aside: Looked at rewriting the regex to see if it can be better on performance. This should be better regex using alternates: ^(\/([0-9a-z-]+|({[0-9a-zA-Z-]+})+)*)+$ . No change though, same issue.
The text was updated successfully, but these errors were encountered:
With the rule (https://github.com/SPSCommerce/sps-api-standards/blob/main/rulesets/src/url-structure.ruleset.yml#L88):
The Spectral CLI seems to hang on failing matches of longer paths. It looks like it eventually will complete but is a performance issue or leak that results in the linting going from 2 seconds to over 60+ minutes.
The following is a simplified example to reproduce:
Spectral Ruleset:
OpenAPI Spec:
Local execution (with node 16.14.0 and Spectral 6.4.2 (latest at time of writing)):
Hangs with the following output frozen:
By modifying the path to pass the regex, it passes instantly:
/v1/api/project-retailer/thinking-very-long/{myTest}
or even shortening the path works instantly as well:/v1/{my_test}
.Small Aside: Looked at rewriting the regex to see if it can be better on performance. This should be better regex using alternates:
^(\/([0-9a-z-]+|({[0-9a-zA-Z-]+})+)*)+$
. No change though, same issue.The text was updated successfully, but these errors were encountered: