From b0b95997cef9fad34706d6eac2baae5aea22dd6f Mon Sep 17 00:00:00 2001 From: Electric Sidecar Date: Mon, 30 Sep 2024 19:45:29 -0700 Subject: [PATCH] Update schemas for 29 bit CAN (#1) Co-authored-by: Jeff Verkoeyen --- .github/workflows/json-yaml-validate.yml | 6 +- schema/status.json | 26 +++++ schema/v2.json | 125 ----------------------- schema/v3.json | 4 +- signalsets/v2/default.json | 2 - 5 files changed, 31 insertions(+), 132 deletions(-) create mode 100644 schema/status.json delete mode 100644 schema/v2.json delete mode 100644 signalsets/v2/default.json diff --git a/.github/workflows/json-yaml-validate.yml b/.github/workflows/json-yaml-validate.yml index ed9c0ff..a183681 100644 --- a/.github/workflows/json-yaml-validate.yml +++ b/.github/workflows/json-yaml-validate.yml @@ -23,7 +23,7 @@ jobs: base_dir: signalsets/v3/ json_schema: schema/v3.json - json-yaml-validate-v2: + json-yaml-validate-meta: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -33,5 +33,5 @@ jobs: uses: GrantBirki/json-yaml-validate@v2.7.1 with: comment: "true" - base_dir: signalsets/v2/ - json_schema: schema/v2.json + base_dir: meta/ + json_schema: schema/status.json diff --git a/schema/status.json b/schema/status.json new file mode 100644 index 0000000..409c6f1 --- /dev/null +++ b/schema/status.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "testers": { + "type": "object", + "patternProperties": { + "^[0-9]{4}$": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "onboarded": { + "type": "string", + "format": "date" + } + }, + "required": ["username", "onboarded"] + } + }, + "additionalProperties": false + } + }, + "required": ["testers"] + } \ No newline at end of file diff --git a/schema/v2.json b/schema/v2.json deleted file mode 100644 index b9ffac5..0000000 --- a/schema/v2.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "type": "object", - "properties": { - "commands": { - "type": "array", - "uniqueItems": true, - "minItems": 0, - "items": { - "type": "object", - "properties": { - "hdr": { "type": "string", "minLength": 3, "maxLength": 3 }, - "rax": { "type": "string", "minLength": 3, "maxLength": 3 }, - "fcm1": { "type": "boolean" }, - "cmd": { - "type": "object", - "properties": { - "01": { "type": "string", "minLength": 2, "maxLength": 2 }, - "22": { "type": "string", "minLength": 4, "maxLength": 4 } - } - }, - "freq": { "type": "number", "exclusiveMinimum": 0 }, - "signals": { - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { - "type": "object", - "properties": { - "id": { "type": "string" }, - "name": { "type": "string" }, - "fmt": { - "type": "object", - "properties": { - "bix": { "type": "integer" }, - "len": { "type": "integer" }, - "sign": { "type": "boolean" }, - "min": { "type": "number" }, - "max": { "type": "number" }, - "add": { "type": "number" }, - "mul": { "type": "number" }, - "unit": { "enum": [ - "bars", - "celsius", - "degrees", - "gramsPerSecond", - "gravity", - "hours", - "kilometers", - "kilometersPerHour", - "kilopascal", - "kilowattHours", - "liters", - "miles", - "milliamps", - "minutes", - "noyes", - "offon", - "percent", - "psi", - "radians", - "rpm", - "scalar", - "seconds", - "unknown", - "volts", - "yesno" - ]}, - "omin": { "type": "number" }, - "omax": { "type": "number" }, - "oval": { "type": "number" }, - "map": { "type": "object" } - } - }, - "path": { "type": "string" }, - "suggestedMetric": { "enum": [ - "fuelTankLevel", - "odometer", - "speed", - "stateOfCharge", - "stateOfHealth" - ]}, - "description": { "type": "string" } - }, - "required": [ - "id", - "fmt", - "name" - ] - } - } - }, - "required": [ - "hdr", - "cmd", - "freq", - "signals" - ] - } - }, - "signalGroups": { - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { - "type": "object", - "properties": { - "id": { "type": "string" }, - "matchingRegex": { "type": "string" }, - "suggestedMetricGroup": { "enum": [ - "batteryModulesStateOfCharge", - "batteryModulesVoltage" - ]}, - "name": { "type": "string" } - }, - "required": [ - "id", - "matchingRegex" - ] - } - } - }, - "required": [ - "commands" - ] -} diff --git a/schema/v3.json b/schema/v3.json index cb6dbe6..c7246ac 100644 --- a/schema/v3.json +++ b/schema/v3.json @@ -13,8 +13,8 @@ "items": { "type": "object", "properties": { - "hdr": { "type": "string", "minLength": 3, "maxLength": 3 }, - "rax": { "type": "string", "minLength": 3, "maxLength": 3 }, + "hdr": { "type": "string", "minLength": 3, "maxLength": 4 }, + "rax": { "type": "string", "minLength": 2, "maxLength": 3 }, "fcm1": { "type": "boolean" }, "cmd": { "type": "object", diff --git a/signalsets/v2/default.json b/signalsets/v2/default.json deleted file mode 100644 index 87221d0..0000000 --- a/signalsets/v2/default.json +++ /dev/null @@ -1,2 +0,0 @@ -{ "commands": [] -} \ No newline at end of file