Skip to content

Commit

Permalink
Repeat arg fixes (#10)
Browse files Browse the repository at this point in the history
* Removed nested repeat args
* Changed repeat args so they're an array of arrays
* Removed unnecessary oneOf for repeat args
  • Loading branch information
cohansen authored Feb 16, 2023
1 parent b56782b commit 252e2a2
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 33 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nasa-jpl/seq-json-schema",
"version": "1.0.16",
"version": "1.0.17",
"license": "MIT",
"type": "module",
"repository": {
Expand Down
42 changes: 21 additions & 21 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
15 changes: 15 additions & 0 deletions test/invalid-seq-json/nested-repeat-arg.seq.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
20 changes: 14 additions & 6 deletions test/valid-seq-json/all-possible-fields.seq.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
]
]
}
],
Expand Down Expand Up @@ -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" }
]
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 252e2a2

Please sign in to comment.