api-quality-spectral-ruleset 1.4.0-beta.1 → 1.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/apq-spectral.yaml
CHANGED
|
@@ -220,7 +220,7 @@ rules:
|
|
|
220
220
|
then:
|
|
221
221
|
function: apq-alternate-paths
|
|
222
222
|
functionOptions:
|
|
223
|
-
except: ["me", "get", "search"]
|
|
223
|
+
except: ["me", "get", "search", "delete"]
|
|
224
224
|
apiq:OAR018:
|
|
225
225
|
description: Operation not recommended for resource path depending on HTTP verb
|
|
226
226
|
message: "OAR018: Operation not recommended for resource path: {{path}} ({{verb}})"
|
|
@@ -528,7 +528,7 @@ rules:
|
|
|
528
528
|
functionOptions:
|
|
529
529
|
notMatch: "^(Cookie|Set-Cookie)$"
|
|
530
530
|
apiq:OAR037:
|
|
531
|
-
description: "
|
|
531
|
+
description: "If a string schema declares a format, it must be a valid format value."
|
|
532
532
|
message: "OAR037: String schemas must specify a valid format (date, date-time, password, byte, binary, email, uuid, uri, hostname, ipv4, ipv6, HEX, HEX(16), json, xml, or base64)."
|
|
533
533
|
severity: error
|
|
534
534
|
given: "$..[?(@.type=='string')]"
|
|
@@ -620,11 +620,14 @@ rules:
|
|
|
620
620
|
description: "Declared media type should conform to RFC6838 and RFC7231."
|
|
621
621
|
message: "OAR044: Declared media type range should conform to RFC7231."
|
|
622
622
|
severity: "error"
|
|
623
|
-
given:
|
|
623
|
+
given:
|
|
624
|
+
- "$.paths.*.*.responses.*.content.*~"
|
|
625
|
+
- "$.paths.*.*.requestBody.content.*~"
|
|
626
|
+
- "$.components.requestBodies.*.content.*~"
|
|
624
627
|
then:
|
|
625
628
|
function: pattern
|
|
626
629
|
functionOptions:
|
|
627
|
-
match: "^
|
|
630
|
+
match: "^(\\*|[a-zA-Z0-9][a-zA-Z0-9!#$&\\-^_.+]*)/(\\*|[a-zA-Z0-9][a-zA-Z0-9!#$&\\-^_.+]*)(;\\s*[a-zA-Z0-9]+=[\\w\\-]+)*$"
|
|
628
631
|
apiq:OAR045:
|
|
629
632
|
description: "Response schema is required for responses with status codes 201 and others that return content."
|
|
630
633
|
message: "OAR045: Response schema is required for status code '{{property}}'."
|
|
@@ -6,7 +6,7 @@ const VALID_FORMATS = new Set([
|
|
|
6
6
|
|
|
7
7
|
module.exports = (targetVal, _options, context) => {
|
|
8
8
|
const format = targetVal.format;
|
|
9
|
-
if (format
|
|
9
|
+
if (format !== undefined && format !== null && !VALID_FORMATS.has(String(format).toLowerCase())) {
|
|
10
10
|
return [{ message: context.rule.message }];
|
|
11
11
|
}
|
|
12
12
|
return [];
|