Repository: ChristopheBougere/asl-validator
Pull request #68 (2021-02-17 17:15:15)

Allowing array and object in Parameters
cf #67 


Patch:
diff --git a/package-lock.json b/package-lock.json
index 1302269..41cfd35 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "asl-validator",
-  "version": "1.9.4",
+  "version": "1.9.5",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index 6e5525d..9aa5af6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "asl-validator",
-  "version": "1.9.4",
+  "version": "1.9.5",
   "description": "Amazon States Language validator",
   "main": "./src/validator.js",
   "bin": {
diff --git a/src/schemas/map.json b/src/schemas/map.json
index 31fdd72..472005e 100644
--- a/src/schemas/map.json
+++ b/src/schemas/map.json
@@ -36,7 +36,10 @@
       "$ref": "http://asl-validator.cloud/state-machine#"
     },
     "Parameters": {
-      "type": "object"
+      "type": ["object", "array"],
+      "items": {
+        "type": "object"
+      }
     },
     "ResultSelector": {
       "type": "object"
diff --git a/src/schemas/parallel.json b/src/schemas/parallel.json
index ed1c2b2..7018320 100644
--- a/src/schemas/parallel.json
+++ b/src/schemas/parallel.json
@@ -8,7 +8,10 @@
       "pattern": "^Parallel$"
     },
     "Parameters": {
-      "type": "object"
+      "type": ["object", "array"],
+      "items": {
+        "type": "object"
+      }
     },
     "ResultSelector": {
       "type": "object"
diff --git a/src/schemas/pass.json b/src/schemas/pass.json
index 0c37468..f02d425 100644
--- a/src/schemas/pass.json
+++ b/src/schemas/pass.json
@@ -26,7 +26,10 @@
       "type": "string"
     },
     "Parameters": {
-      "type": "object"
+      "type": ["object", "array"],
+      "items": {
+        "type": "object"
+      }
     },
     "Result": {}
   },
diff --git a/src/schemas/task.json b/src/schemas/task.json
index df80bb9..e60fecc 100644
--- a/src/schemas/task.json
+++ b/src/schemas/task.json
@@ -99,7 +99,10 @@
       "type": "object"
     },
     "Parameters": {
-      "type": "object"
+      "type": ["object", "array"],
+      "items": {
+        "type": "object"
+      }
     }
   },
   "oneOf": [{


Test patch:
diff --git a/src/__tests__/definitions/valid-parameters-array.json b/src/__tests__/definitions/valid-parameters-array.json
new file mode 100644
index 0000000..aa9550e
--- /dev/null
+++ b/src/__tests__/definitions/valid-parameters-array.json
@@ -0,0 +1,14 @@
+{
+  "StartAt": "pass-execution-details",
+  "States": {
+    "pass-execution-details": {
+      "Type": "Pass",
+      "Parameters": [{
+        "execution_id.$": "$$.Execution.Id",
+        "timestamp.$": "$$.Execution.StartTime"
+      }],
+      "ResultPath": "$.execution_details",
+      "End": true
+    }
+  }
+}
diff --git a/src/__tests__/definitions/valid-parameters-object.json b/src/__tests__/definitions/valid-parameters-object.json
new file mode 100644
index 0000000..91b32ce
--- /dev/null
+++ b/src/__tests__/definitions/valid-parameters-object.json
@@ -0,0 +1,14 @@
+{
+  "StartAt": "pass-execution-details",
+  "States": {
+    "pass-execution-details": {
+      "Type": "Pass",
+      "Parameters": {
+        "execution_id.$": "$$.Execution.Id",
+        "timestamp.$": "$$.Execution.StartTime"
+      },
+      "ResultPath": "$.execution_details",
+      "End": true
+    }
+  }
+}