Repository: NASA-AMMOS/seq-json-schema (language: python)

Issue:
Repeat argument fixes
We need to:

1. Remove the nested repeat argument since it's [not supported in the AMPCS command dictionary spec](https://github.com/NASA-AMMOS/ampcs-dict-schemas/blob/a7b7c4e2436df8c319218cbf0f2741e8752a1785/CommandDictionary.rnc#L543):
https://github.com/NASA-AMMOS/seq-json-schema/blob/b56782b6434b3deb9fa60ddfec70cfc59877acec/schema.json#L445
2. Make the repeat arg an array of arrays so we can actually repeat the arguments.
https://github.com/NASA-AMMOS/seq-json-schema/blob/b56782b6434b3deb9fa60ddfec70cfc59877acec/schema.json#L424

We should add tests that cover both of these changes.


Discussion / hints:

Fix patch:
diff --git a/package-lock.json b/package-lock.json
index d0f2014..c0a4a07 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "@nasa-jpl/seq-json-schema",
-  "version": "1.0.16",
+  "version": "1.0.17",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "@nasa-jpl/seq-json-schema",
-      "version": "1.0.16",
+      "version": "1.0.17",
       "license": "MIT",
       "devDependencies": {
         "ajv": "^8.12.0",
diff --git a/package.json b/package.json
index 8e6d965..149750e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@nasa-jpl/seq-json-schema",
-  "version": "1.0.16",
+  "version": "1.0.17",
   "license": "MIT",
   "type": "module",
   "repository": {
diff --git a/schema.json b/schema.json
index f7dd26c..1ae9893 100644
--- a/schema.json
+++ b/schema.json
@@ -422,29 +422,29 @@
           "const": "repeat"
         },
         "value": {
-          "description": "A repeat argument value, there can be a nested repeat arguments inside.",
+          "description": "A repeat argument value.",
           "type": "array",
           "items": {
-            "oneOf": [
-              {
-                "$ref": "#/$defs/string_argument"
-              },
-              {
-                "$ref": "#/$defs/number_argument"
-              },
-              {
-                "$ref": "#/$defs/boolean_argument"
-              },
-              {
-                "$ref": "#/$defs/symbol_argument"
-              },
-              {
-                "$ref": "#/$defs/hex_argument"
-              },
-              {
-                "$ref": "#/$defs/repeat_argument"
-              }
-            ]
+            "type": "array",
+            "items": {
+              "oneOf": [
+                {
+                  "$ref": "#/$defs/string_argument"
+                },
+                {
+                  "$ref": "#/$defs/number_argument"
+                },
+                {
+                  "$ref": "#/$defs/boolean_argument"
+                },
+                {
+                  "$ref": "#/$defs/symbol_argument"
+                },
+                {
+                  "$ref": "#/$defs/hex_argument"
+                }
+              ]
+            }
           }
         }
       },
diff --git a/setup.py b/setup.py
index 25a045e..8794490 100644
--- a/setup.py
+++ b/setup.py
@@ -14,5 +14,5 @@
   name='seq-json-schema',
   packages=['seq-json-schema'],
   url='https://github.com/NASA-AMMOS/seq-json-schema',
-  version='1.0.16'
+  version='1.0.17'
 )
diff --git a/types.ts b/types.ts
index 75b9c5c..c409c39 100644
--- a/types.ts
+++ b/types.ts
@@ -269,9 +269,9 @@ export interface RepeatArgument {
    */
   type: 'repeat';
   /**
-   * A repeat argument value, there can be a nested repeat arguments inside.
+   * A repeat argument value.
    */
-  value: (StringArgument | NumberArgument | BooleanArgument | SymbolArgument | HexArgument | RepeatArgument)[];
+  value: (StringArgument | NumberArgument | BooleanArgument | SymbolArgument | HexArgument)[][];
 }
 /**
  * Model object that be included with commands to set variables for modeling purposes only, usually to direct sequence execution down a particular branch during modeling.


Test patch:
diff --git a/test/invalid-seq-json/nested-repeat-arg.seq.json b/test/invalid-seq-json/nested-repeat-arg.seq.json
new file mode 100644
index 0000000..b93d4cc
--- /dev/null
+++ b/test/invalid-seq-json/nested-repeat-arg.seq.json
@@ -0,0 +1,15 @@
+{
+  "id": "nested-repeat-arg",
+  "metadata": {},
+  "steps": [
+    {
+      "args": [{ "type": "repeat", "value": [[{ "type": "repeat", "value": [[{ "type": "number", "value": 10 }]] }]] }],
+      "stem": "HELLO",
+      "time": {
+        "tag": "00:00:01",
+        "type": "EPOCH_RELATIVE"
+      },
+      "type": "command"
+    }
+  ]
+}
diff --git a/test/valid-seq-json/all-possible-fields.seq.json b/test/valid-seq-json/all-possible-fields.seq.json
index 4a046b3..a82da6a 100644
--- a/test/valid-seq-json/all-possible-fields.seq.json
+++ b/test/valid-seq-json/all-possible-fields.seq.json
@@ -52,10 +52,16 @@
         {
           "type": "repeat",
           "value": [
-            { "type": "number", "value": 10 },
-            { "type": "string", "value": "another_test" },
-            { "type": "boolean", "value": false },
-            { "type": "repeat", "value": [{ "type": "number", "value": 1 }] }
+            [
+              { "type": "number", "value": 10 },
+              { "type": "string", "value": "another_test" },
+              { "type": "boolean", "value": false }
+            ],
+            [
+              { "type": "number", "value": 5 },
+              { "type": "string", "value": "repeat_test" },
+              { "type": "boolean", "value": true }
+            ]
           ]
         }
       ],
@@ -97,8 +103,10 @@
         {
           "type": "repeat",
           "value": [
-            { "type": "number", "value": 10 },
-            { "type": "string", "value": "another_test" }
+            [
+              { "type": "number", "value": 10 },
+              { "type": "string", "value": "another_test" }
+            ]
           ]
         }
       ],