Skip to content

Commit

Permalink
Add note and block relative (#32)
Browse files Browse the repository at this point in the history
* Add BLOCK_RELATIVE time tag type.

* Add note construct.

* add valid note test

* update setup.py to require jsonschema, and update owner name

* Update version in package.json

* add note as allowed step type

* updated tests to add BLOCK_RELATIVE

* updated versions

* Add missing tag to test

* Fxi note description

* add 'jsonschema' as a required package

* updated schema so tag is required for everyting but COMMAND_COMPLETE

* update test to include missing tag

* update test to include cases with missing tags
  • Loading branch information
shaheerk94 authored Jan 21, 2025
1 parent c153e91 commit a86786f
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 25 deletions.
2 changes: 1 addition & 1 deletion 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.2.0",
"version": "1.3.0",
"license": "MIT",
"type": "module",
"repository": {
Expand Down
55 changes: 51 additions & 4 deletions schema.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -420,6 +450,9 @@
},
{
"$ref": "#/$defs/load"
},
{
"$ref": "#/$defs/note"
}
]
},
Expand All @@ -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": {
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
61 changes: 61 additions & 0 deletions test/invalid-seq-json/time-missing-type-and-tag.seq.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
37 changes: 33 additions & 4 deletions test/valid-seq-json/all-possible-fields.seq.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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] }
}
]
}

0 comments on commit a86786f

Please sign in to comment.