api-quality-spectral-ruleset 1.3.0-beta.2 → 1.3.0-beta.3
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
|
@@ -67,7 +67,7 @@ rules:
|
|
|
67
67
|
then:
|
|
68
68
|
function: "pattern"
|
|
69
69
|
functionOptions:
|
|
70
|
-
match: "^[
|
|
70
|
+
match: "^[a-zA-Z0-9_\\-., ]+$"
|
|
71
71
|
apiq:OAR005:
|
|
72
72
|
description: "A wrong scope may cause problems to import the API definition into WSO2 or allow all users to call the endpoint."
|
|
73
73
|
message: "OAR005: Scope in the operation must be defined correctly and match an existing scope."
|
|
@@ -106,9 +106,9 @@ rules:
|
|
|
106
106
|
message: "OAR008: Only the REST standard verbs are allowed (POST, GET, PUT, PATCH and DELETE)."
|
|
107
107
|
documentationUrl: "https://github.com/apiaddicts/apquality-spectral/blob/main/docs/resources/OAR008.md"
|
|
108
108
|
severity: error
|
|
109
|
-
given: "$.paths[*][
|
|
109
|
+
given: "$.paths[*][head,options,trace]"
|
|
110
110
|
then:
|
|
111
|
-
function:
|
|
111
|
+
function: falsy
|
|
112
112
|
apiq:OAR009:
|
|
113
113
|
description: "Default request media type should be defined for operations."
|
|
114
114
|
message: "OAR009: Default request media type is mandatory."
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
module.exports = (given, options, context) => {
|
|
7
7
|
if (given === null || given === undefined) return [];
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const doc = context.document?.data ?? {};
|
|
10
|
+
const isOAP2 = typeof doc.swagger === 'string';
|
|
11
|
+
|
|
12
|
+
const VALID_IN_VALUES_OAP2 = ['query', 'header', 'path', 'formData', 'body'];
|
|
13
|
+
const VALID_IN_VALUES_OAP3 = ['path', 'query', 'header', 'cookie'];
|
|
14
|
+
const VALID_IN_VALUES = isOAP2 ? VALID_IN_VALUES_OAP2 : VALID_IN_VALUES_OAP3;
|
|
15
|
+
|
|
16
|
+
const VALID_SCHEMA_TYPES = ['object', 'string', 'number', 'integer', 'boolean', 'array', 'null'];
|
|
11
17
|
|
|
12
18
|
const nodePath = context.path || [];
|
|
13
19
|
const fieldName = nodePath[nodePath.length - 1];
|