diff --git a/bids-validator/validators/json/json.js b/bids-validator/validators/json/json.js index bf0c8aa65..2f0e63445 100644 --- a/bids-validator/validators/json/json.js +++ b/bids-validator/validators/json/json.js @@ -161,6 +161,8 @@ const selectSchema = (file) => { schema = require('./schemas/beh.json') } else if (file.name.endsWith('_motion.json')) { schema = require('./schemas/motion.json') + } else if (file.name.endsWith('_channels.json')) { + schema = require('./schemas/channels.json') } } return schema diff --git a/bids-validator/validators/json/schemas/channels.json b/bids-validator/validators/json/schemas/channels.json new file mode 100644 index 000000000..e4be45d89 --- /dev/null +++ b/bids-validator/validators/json/schemas/channels.json @@ -0,0 +1,47 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "allOf": [ + { + "type": "object", + "properties": { + "reference_frame": { + "title": "Reference Frame", + "type": "object", + "properties": { + "Levels": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "object", + "properties": { + "RotationOrder": { + "description": "The sequence in which the extrinsic rotations are applied around the three axes.", + "type": "string", + "enum": ["XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"] + }, + "RotationRule": { + "description": "The direction of rotation around each axis.", + "type": "string", + "enum": ["left-hand", "right-hand"] + }, + "SpatialAxes": { + "description": "The coordinate system in which the motion data are to be interpreted. A sequence of characters from the set `{'A', 'P', 'L', 'R', 'S', 'I', '_'}` indicating the direction of each axis. For example `\"ARS\"` indicates positive values in the X, Y, Z axes are respectively anterior, right, and superior of the origin, while `\"PLI\"` indicates positive values are posterior, left, and inferior of the origin. The `\"_\"` character may be used for unused axes.", + "type": "string", + "pattern": "^[APLRSI_]{3}$" + } + } + } + } + } + } + } + } + }, + { + "type": "object", + "patternProperties": { + "^.+$": { "$ref": "common_definitions.json#/definitions/ColumnDescription" } + } + } + ] +} diff --git a/bids-validator/validators/json/schemas/common_definitions.json b/bids-validator/validators/json/schemas/common_definitions.json index ad0e9bf40..5980ca3c2 100644 --- a/bids-validator/validators/json/schemas/common_definitions.json +++ b/bids-validator/validators/json/schemas/common_definitions.json @@ -122,6 +122,73 @@ "SoftwareVersions": { "type": "string" }, "TaskDescription": { "type": "string" }, "TaskName": { "type": "string", "minLength": 1 }, - "TriggerChannelCount": { "type": "integer", "minimum": 0 } + "TermURL": { + "title": "TermURL", + "description": "URL pointing to a formal definition in an ontology available on the web.", + "type": "string", + "format": "uri" + }, + "TriggerChannelCount": { "type": "integer", "minimum": 0 }, + "ColumnDescription": { + "type": "object", + "title": "Column", + "description": "Column of a corresponding tabular file.", + "properties": { + "LongName": { + "title": "LongName", + "description": " Long (unabbreviated) name of column.", + "type": "string" + }, + "Description": { + "title": "Description", + "description": "Description of the column.", + "type": "string" + }, + "Units": { + "title": "Units", + "description": "Measurement units.", + "type": "string" + }, + "Levels": { + "type": "object", + "title": "Levels", + "description": "For categorical variables: a dictionary of possible values (keys) and their descriptions (values).", + "patternProperties": { + "^.+$": { + "anyOf": [ + { "type": "string" }, + { + "type": "object", + "properties": { + "Description": { "type": "string" }, + "TermURL": { "$ref": "#/definitions/TermURL" } + } + } + ] + } + } + }, + "TermURL": { "$ref": "#/definitions/TermURL" }, + "HED": { + "anyOf": [ + { + "type": "object", + "title": "HED", + "description": "For categorical variables: a dictionary of possible values (keys) and their HED strings (values).", + "patternProperties": { + "^.+$": { + "type": "string" + } + } + }, + { + "type": "string", + "title": "HED", + "description": "For value variables: a string with a single '#' character where the cell value is to be interpolated." + } + ] + } + } + } } } diff --git a/bids-validator/validators/json/schemas/data_dictionary.json b/bids-validator/validators/json/schemas/data_dictionary.json index 75322abac..f3bfc1921 100644 --- a/bids-validator/validators/json/schemas/data_dictionary.json +++ b/bids-validator/validators/json/schemas/data_dictionary.json @@ -1,76 +1,6 @@ { "type": "object", "patternProperties": { - "^.+$": { - "type": "object", - "title": "Column", - "description": "Column of a corresponding tabular file.", - "properties": { - "LongName": { - "title": "LongName", - "description": " Long (unabbreviated) name of column.", - "type": "string" - }, - "Description": { - "title": "Description", - "description": "Description of the column.", - "type": "string" - }, - "Units": { - "title": "Units", - "description": "Measurement units.", - "type": "string" - }, - "Levels": { - "type": "object", - "title": "Levels", - "description": "For categorical variables: a dictionary of possible values (keys) and their descriptions (values).", - "patternProperties": { - "^.+$": { - "anyOf": [ - { "type": "string" }, - { - "type": "object", - "properties": { - "Description": { "type": "string" }, - "TermURL": { - "title": "TermURL", - "description": "URL pointing to a formal definition in an ontology available on the web.", - "type": "string", - "format": "uri" - } - } - } - ] - } - } - }, - "TermURL": { - "title": "TermURL", - "description": "URL pointing to a formal definition in an ontology available on the web.", - "type": "string", - "format": "uri" - }, - "HED": { - "anyOf": [ - { - "type": "object", - "title": "HED", - "description": "For categorical variables: a dictionary of possible values (keys) and their HED strings (values).", - "patternProperties": { - "^.+$": { - "type": "string" - } - } - }, - { - "type": "string", - "title": "HED", - "description": "For value variables: a string with a single '#' character where the cell value is to be interpolated." - } - ] - } - } - } + "^.+$": { "$ref": "common_definitions.json#/definitions/ColumnDescription" } } } diff --git a/bids-validator/validators/json/schemas/events.json b/bids-validator/validators/json/schemas/events.json index 73d27e47d..bace2aa3a 100644 --- a/bids-validator/validators/json/schemas/events.json +++ b/bids-validator/validators/json/schemas/events.json @@ -1,71 +1,7 @@ { "type": "object", "patternProperties": { - "^.+$": { - "type": "object", - "title": "Column", - "description": "Column of a corresponding tabular file.", - "properties": { - "LongName": { - "title": "LongName", - "description": " Long (unabbreviated) name of column.", - "type": "string" - }, - "Description": { - "title": "Description", - "description": "Description of the column.", - "type": "string" - }, - "Units": { - "title": "Units", - "description": "Measurement units.", - "type": "string" - }, - "Levels": { - "type": "object", - "title": "Levels", - "description": "For categorical variables: a dictionary of possible values (keys) and their descriptions (values).", - "patternProperties": { - "^.+$": { - "anyOf": [ - { "type": "string" }, - { - "type": "object", - "properties": { - "Description": { "type": "string" }, - "TermURL": { - "title": "TermURL", - "description": "URL pointing to a formal definition in an ontology available on the web.", - "type": "string", - "format": "uri" - } - } - } - ] - } - } - }, - "HED": { - "anyOf": [ - { - "type": "object", - "title": "HED", - "description": "For categorical variables: a dictionary of possible values (keys) and their HED strings (values).", - "patternProperties": { - "^.+$": { - "type": "string" - } - } - }, - { - "type": "string", - "title": "HED", - "description": "For value variables: a string with a single '#' character where the cell value is to be interpolated." - } - ] - } - } - } + "^.+$": { "$ref": "common_definitions.json#/definitions/ColumnDescription" } }, "properties": { "StimulusPresentation": {