diff --git a/schema/core.json b/schema/core.json index bb8d2cc..f89260b 100644 --- a/schema/core.json +++ b/schema/core.json @@ -1,5 +1,5 @@ { - "$schema": "https://json-schema.org/draft-07/schema", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://harp-tech.org/draft-03/schema/core.json", "type": "object", "allOf": [ @@ -7,12 +7,17 @@ "properties": { "protocolVersion": { "description": "Specifies the version of the device protocol.", - "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", - "type": "string" + "$ref": "#/$defs/version" } }, "required": ["protocolVersion"] }, { "$ref": "registers.json" } - ] + ], + "$defs": { + "version": { + "type": "string", + "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$" + } + } } \ No newline at end of file diff --git a/schema/device.json b/schema/device.json index 2fe833d..9eaee64 100644 --- a/schema/device.json +++ b/schema/device.json @@ -1,5 +1,5 @@ { - "$schema": "https://json-schema.org/draft-07/schema", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://harp-tech.org/draft-03/schema/device.json", "type": "object", "allOf": [ @@ -15,13 +15,19 @@ }, "firmwareVersion": { "description": "Specifies the version of the device firmware.", - "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", - "type": "string" + "$ref": "core.json#/$defs/version" }, "hardwareTargets": { - "description": "Specifies the version of the device hardware.", - "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", - "type": "string" + "description": "Specifies the version of the hardware targets.", + "oneOf": [ + { "$ref": "core.json#/$defs/version" }, + { + "type": "array", + "items": { "$ref": "core.json#/$defs/version" }, + "uniqueItems": true, + "minItems": 1 + } + ] }, "registers": { "additionalProperties": { diff --git a/schema/ios.json b/schema/ios.json index e47515c..41d9aea 100644 --- a/schema/ios.json +++ b/schema/ios.json @@ -1,15 +1,15 @@ { - "$schema": "https://json-schema.org/draft-07/schema", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://harp-tech.org/draft-03/schema/ios.json", "type": "object", "description": "Specifies the IO pin configuration used to automatically generate firmware.", "additionalProperties": { "oneOf": [ - { "$ref": "#/definitions/inputPin" }, - { "$ref": "#/definitions/outputPin" } + { "$ref": "#/$defs/inputPin" }, + { "$ref": "#/$defs/outputPin" } ] }, - "definitions": { + "$defs": { "portPin": { "type": "object", "properties": { @@ -34,7 +34,7 @@ "required": ["port", "pinNumber", "direction"] }, "inputPin": { - "allOf": [{ "$ref": "#/definitions/portPin" }], + "allOf": [{ "$ref": "#/$defs/portPin" }], "properties": { "direction": { "enum": ["input"] @@ -62,7 +62,7 @@ } }, "outputPin": { - "allOf": [{ "$ref": "#/definitions/portPin" }], + "allOf": [{ "$ref": "#/$defs/portPin" }], "properties": { "direction": { "enum": ["output"] diff --git a/schema/registers.json b/schema/registers.json index ad1913f..3928485 100644 --- a/schema/registers.json +++ b/schema/registers.json @@ -1,26 +1,26 @@ { - "$schema": "https://json-schema.org/draft-07/schema", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://harp-tech.org/draft-03/schema/registers.json", "type": "object", "properties": { "registers": { "type": "object", "description": "Specifies the collection of registers implementing the device function.", - "additionalProperties": { "$ref": "#/definitions/register" } + "additionalProperties": { "$ref": "#/$defs/register" } }, "bitMasks": { "type": "object", "description": "Specifies the collection of masks available to be used with the different registers.", - "additionalProperties": { "$ref": "#/definitions/bitMask" } + "additionalProperties": { "$ref": "#/$defs/bitMask" } }, "groupMasks": { "type": "object", "description": "Specifies the collection of group masks available to be used with the different registers.", - "additionalProperties": { "$ref": "#/definitions/groupMask" } + "additionalProperties": { "$ref": "#/$defs/groupMask" } } }, "required": ["registers"], - "definitions": { + "$defs": { "type": { "description": "Specifies the type of the register payload.", "type": "string", @@ -60,7 +60,7 @@ }, "bits": { "type": "object", - "additionalProperties": { "$ref": "#/definitions/maskValue" } + "additionalProperties": { "$ref": "#/$defs/maskValue" } } }, "required": ["bits"] @@ -75,7 +75,7 @@ }, "values": { "type": "object", - "additionalProperties": { "$ref": "#/definitions/maskValue" } + "additionalProperties": { "$ref": "#/$defs/maskValue" } } }, "required": ["values"] @@ -120,12 +120,12 @@ "description": "Specifies a summary description of the payload member.", "type": "string" }, - "minValue": { "$ref": "#/definitions/minValue" }, - "maxValue": { "$ref": "#/definitions/maxValue" }, - "defaultValue": { "$ref": "#/definitions/defaultValue" }, - "maskType": { "$ref": "#/definitions/maskType" }, - "interfaceType": { "$ref": "#/definitions/interfaceType" }, - "converter": { "$ref": "#/definitions/converter" } + "minValue": { "$ref": "#/$defs/minValue" }, + "maxValue": { "$ref": "#/$defs/maxValue" }, + "defaultValue": { "$ref": "#/$defs/defaultValue" }, + "maskType": { "$ref": "#/$defs/maskType" }, + "interfaceType": { "$ref": "#/$defs/interfaceType" }, + "converter": { "$ref": "#/$defs/converter" } } }, "register": { @@ -136,7 +136,7 @@ "type": "integer", "maximum": 255 }, - "type": { "$ref": "#/definitions/type" }, + "type": { "$ref": "#/$defs/type" }, "length": { "description": "Specifies the length of the register payload.", "type": "integer", @@ -145,10 +145,10 @@ "access": { "description": "Specifies the expected use of the register.", "oneOf": [ - { "$ref": "#/definitions/access" }, + { "$ref": "#/$defs/access" }, { "type": "array", - "items": { "$ref": "#/definitions/access" }, + "items": { "$ref": "#/$defs/access" }, "uniqueItems": true, "minItems": 1, "maxItems": 3 @@ -159,10 +159,10 @@ "description": "Specifies a summary description of the register function.", "type": "string" }, - "minValue": { "$ref": "#/definitions/minValue" }, - "maxValue": { "$ref": "#/definitions/maxValue" }, - "defaultValue": { "$ref": "#/definitions/defaultValue" }, - "maskType": { "$ref": "#/definitions/maskType" }, + "minValue": { "$ref": "#/$defs/minValue" }, + "maxValue": { "$ref": "#/$defs/maxValue" }, + "defaultValue": { "$ref": "#/$defs/defaultValue" }, + "maskType": { "$ref": "#/$defs/maskType" }, "visibility": { "description": "Specifies whether the register function is exposed in the high-level interface.", "type": "string", @@ -174,10 +174,10 @@ }, "payloadSpec": { "type": "object", - "additionalProperties": { "$ref": "#/definitions/payloadMember" } + "additionalProperties": { "$ref": "#/$defs/payloadMember" } }, - "interfaceType": { "$ref": "#/definitions/interfaceType" }, - "converter": { "$ref": "#/definitions/converter" } + "interfaceType": { "$ref": "#/$defs/interfaceType" }, + "converter": { "$ref": "#/$defs/converter" } }, "required": ["address", "access", "type"] }