diff --git a/package-lock.json b/package-lock.json index a58130c..2baf05a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@nasa-jpl/seq-json-schema", - "version": "1.2.0", + "version": "1.3.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 4fa098c..d6cc275 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nasa-jpl/seq-json-schema", - "version": "1.2.0", + "version": "1.3.0", "license": "MIT", "type": "module", "repository": { diff --git a/schema.json b/schema.json index ddb92f3..b60a133 100644 --- a/schema.json +++ b/schema.json @@ -1,5 +1,5 @@ { - "$id": "https://github.com/NASA-AMMOS/seq-json-schema/tree/v1.2.0", + "$id": "https://github.com/NASA-AMMOS/seq-json-schema/tree/v1.3.0", "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { "immediate_activate": { @@ -361,6 +361,36 @@ "required": ["offset", "value", "variable"], "type": "object" }, + "note": { + "additionalProperties": false, + "description": "Used to add a note within a sequence at a specific instant. Can be used by command & sequence simulator tools to print the string argument at the relevant instant within simulations.", + "properties": { + "string_arg": { + "description": "Note string arg.", + "type": "string" + }, + "description": { + "$ref": "#/$defs/description" + }, + "metadata": { + "$ref": "#/$defs/metadata" + }, + "models": { + "items": { + "$ref": "#/$defs/model" + }, + "type": "array" + }, + "time": { + "$ref": "#/$defs/time" + }, + "type": { + "const": "note" + } + }, + "required": ["string_arg", "time", "type"], + "type": "object" + }, "request": { "additionalProperties": false, "description": "Sequence steps can be grouped into a request, which can then be shifted or adjusted altogether as part of the request.", @@ -420,6 +450,9 @@ }, { "$ref": "#/$defs/load" + }, + { + "$ref": "#/$defs/note" } ] }, @@ -446,16 +479,30 @@ "description": "Time object", "properties": { "tag": { - "description": "Relative or absolute time. Required for ABSOLUTE, COMMAND_RELATIVE, and EPOCH_RELATIVE time tags but not COMMAND_COMPLETE.", + "description": "Relative or absolute time. Required for ABSOLUTE, BLOCK_RELATIVE, COMMAND_RELATIVE, and EPOCH_RELATIVE time types but not COMMAND_COMPLETE.", "type": "string" }, "type": { - "description": "Allowed time types: ABSOLUTE, COMMAND_RELATIVE, EPOCH_RELATIVE, or COMMAND_COMPLETE.", - "enum": ["ABSOLUTE", "COMMAND_RELATIVE", "EPOCH_RELATIVE", "COMMAND_COMPLETE"], + "description": "Allowed time types: ABSOLUTE, BLOCK_RELATIVE, COMMAND_RELATIVE, EPOCH_RELATIVE, or COMMAND_COMPLETE.", + "enum": ["ABSOLUTE", "BLOCK_RELATIVE", "COMMAND_RELATIVE", "EPOCH_RELATIVE", "COMMAND_COMPLETE"], "type": "string" } }, "required": ["type"], + "allOf": [ + { + "if": { + "properties": { + "type": { + "enum": ["ABSOLUTE", "BLOCK_RELATIVE", "COMMAND_RELATIVE", "EPOCH_RELATIVE"] + } + } + }, + "then": { + "required": ["tag"] + } + } + ], "type": "object" }, "variable_range": { diff --git a/setup.py b/setup.py index addd17e..45d3873 100644 --- a/setup.py +++ b/setup.py @@ -11,14 +11,15 @@ version = loads(package_json).get('version') setup( - author='camargo', - author_email='Christopher.A.Camargo@jpl.nasa.gov', + author='cmak', + author_email='carter.mak@jpl.nasa.gov', description='Standardized JSON Schema for authoring multi-mission sequences', include_package_data=True, long_description=long_description, long_description_content_type='text/markdown', name='seq-json-schema', packages=['seq-json-schema'], + requires=['jsonschema'], url='https://github.com/NASA-AMMOS/seq-json-schema', version=version ) diff --git a/test/invalid-seq-json/time-missing-type-and-tag.seq.json b/test/invalid-seq-json/time-missing-type-and-tag.seq.json new file mode 100644 index 0000000..ed9dde9 --- /dev/null +++ b/test/invalid-seq-json/time-missing-type-and-tag.seq.json @@ -0,0 +1,61 @@ +{ + "id": "time_missing_type", + "metadata": {}, + "steps": [ + { + "args": [ + { "type": "number", "value": 30 } + ], + "description": "Epoch-relative activate step for test.mod into engine 2 with missing time type.", + "engine": 2, + "epoch": "TEST_EPOCH", + "sequence": "d:/eng/test.mod", + "time": { "tag": "00:00:01.000" }, + "type": "activate" + }, + { + "args": [ + { "type": "number", "value": 30 } + ], + "description": "Command-relative activate step for test.mod into engine 2 with missing time tag.", + "engine": 2, + "epoch": "TEST_EPOCH", + "sequence": "d:/eng/test.mod", + "time": { "type": "COMMAND_RELATIVE" }, + "type": "activate" + }, + { + "args": [ + { "type": "number", "value": 30 } + ], + "description": "Absolute activate step for test.mod into engine 2 with missing time tag.", + "engine": 2, + "epoch": "TEST_EPOCH", + "sequence": "d:/eng/test.mod", + "time": { "type": "ABSOLUTE" }, + "type": "activate" + }, + { + "args": [ + { "type": "number", "value": 30 } + ], + "description": "Block-relative activate step for test.mod into engine 2 with missing time tag.", + "engine": 2, + "epoch": "TEST_EPOCH", + "sequence": "d:/eng/test.mod", + "time": { "type": "BLOCK_RELATIVE" }, + "type": "activate" + }, + { + "args": [ + { "type": "number", "value": 30 } + ], + "description": "Epoch-relative activate step for test.mod into engine 2 with missing time tag.", + "engine": 2, + "epoch": "TEST_EPOCH", + "sequence": "d:/eng/test.mod", + "time": { "type": "EPOCH_RELATIVE" }, + "type": "activate" + } + ] +} diff --git a/test/valid-seq-json/all-possible-fields.seq.json b/test/valid-seq-json/all-possible-fields.seq.json index a82da6a..77c00e6 100644 --- a/test/valid-seq-json/all-possible-fields.seq.json +++ b/test/valid-seq-json/all-possible-fields.seq.json @@ -254,11 +254,40 @@ "time": { "tag": "00:00:01.000", "type": "COMMAND_RELATIVE" }, "type": "command", "args": [] + }, + { + "description": "Note step with all possible fields.", + "models": [ + { + "offset": "00:00:00.000", + "variable": "model_var_float", + "value": "1.234" + }, + { + "offset": "00:00:00.001", + "variable": "model_var_int", + "value": "-1234" + }, + { + "offset": "01:02:03.000", + "variable": "model_var_string", + "value": "Model test string" + }, + { + "offset": "10:00:00.000", + "variable": "model_var_uint", + "value": "1234" + } + ], + "string_arg": "Note Test.", + "time": { "type": "BLOCK_RELATIVE" , "tag": "00:30:00"}, + "type": "note", + "metadata": { "listfield": ["1", 2] } } - ], - "time": { "tag": "2020-173T20:00:00.000", "type": "ABSOLUTE" }, - "type": "request" - }, + ], + "time": { "tag": "2020-173T20:00:00.000", "type": "ABSOLUTE" }, + "type": "request" + }, { "description": "Ground-epoch timed request object with all possible fields", "ground_epoch": { "delta": "+00:30:00", "name": "test_ground_epoch" }, diff --git a/test/invalid-seq-json/time-missing-type.seq.json b/test/valid-seq-json/note-valid.json similarity index 54% rename from test/invalid-seq-json/time-missing-type.seq.json rename to test/valid-seq-json/note-valid.json index 68dbb92..136c3ce 100644 --- a/test/invalid-seq-json/time-missing-type.seq.json +++ b/test/valid-seq-json/note-valid.json @@ -1,17 +1,9 @@ { - "id": "time_missing_type", + "id": "note", "metadata": {}, "steps": [ { - "args": [ - { "type": "number", "value": 30 }, - { "type": "number", "value": 4.3 }, - { "type": "boolean", "value": false }, - { "type": "string", "value": "test_string" } - ], - "description": "Epoch-relative activate step for test.mod into engine 2 with all possible fields.", - "engine": 2, - "epoch": "TEST_EPOCH", + "description": "Note step with all possible fields.", "models": [ { "offset": "00:00:00.000", @@ -34,9 +26,10 @@ "value": "1234" } ], - "sequence": "d:/eng/test.mod", - "time": { "tag": "00:00:01.000" }, - "type": "activate" + "string_arg": "Note Test.", + "time": { "type": "BLOCK_RELATIVE", "tag": "00:30:00" }, + "type": "note", + "metadata": { "listfield": ["1", 2] } } ] }