diff --git a/.github/workflows/json_validate.yml b/.github/workflows/json_validate.yml index d60c042ea..ee4ab17f9 100644 --- a/.github/workflows/json_validate.yml +++ b/.github/workflows/json_validate.yml @@ -15,10 +15,9 @@ jobs: verify-json-validation: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v1 - name: Validate JSON - uses: ScratchAddons/validate-json-action@master - with: - schema: ./schema.json - jsons: | - custom_components/battery_notes/data/library.json + uses: docker://orrosenblatt/validate-json-action:latest + env: + INPUT_SCHEMA: ./schema.json + INPUT_JSONS: custom_components/battery_notes/data/library.json diff --git a/custom_components/battery_notes/data/library.json b/custom_components/battery_notes/data/library.json index a8cd3762e..054fefa93 100644 --- a/custom_components/battery_notes/data/library.json +++ b/custom_components/battery_notes/data/library.json @@ -1,4 +1,5 @@ { + "$schema": "../../../schema.json", "version": 1, "devices": [ { diff --git a/schema.json b/schema.json index 076de0064..f7e79e064 100644 --- a/schema.json +++ b/schema.json @@ -5,6 +5,10 @@ "description": "Library of battery types for devices", "type": "object", "properties": { + "$schema": { + "description": "Schema reference", + "type": "string" + }, "version": { "description": "Version of the library schema", "type": "integer" @@ -21,16 +25,21 @@ ], "properties": { "manufacturer": { - "type": "string" + "type": "string", + "description": "The manufacturer of the device as it appears in Home Assistant." }, "model": { - "type": "string" + "type": "string", + "description": "The model of the device as it appears in Home Assistant." }, "battery_type": { - "type": "string" + "type": "string", + "description": "The type of battery for the device. Should be the most common naming for general batteries, and the IEC naming for battery cells according to Wikipedia." }, "battery_quantity": { - "type": "integer" + "type": "integer", + "exclusiveMinimum": 1, + "description": "The number of batteries required by the device. If a device only has one battery this property should be omitted." } } } @@ -38,6 +47,7 @@ }, "additionalProperties": false, "required": [ + "$schema", "version", "devices" ]