Skip to content

Commit cadc544

Browse files
Schema deosrc (#43)
* Test json validate * Try the old validator
1 parent 02ab2e9 commit cadc544

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

.github/workflows/json_validate.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ jobs:
1515
verify-json-validation:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v1
1919
- name: Validate JSON
20-
uses: ScratchAddons/validate-json-action@master
21-
with:
22-
schema: ./schema.json
23-
jsons: |
24-
custom_components/battery_notes/data/library.json
20+
uses: docker://orrosenblatt/validate-json-action:latest
21+
env:
22+
INPUT_SCHEMA: ./schema.json
23+
INPUT_JSONS: custom_components/battery_notes/data/library.json

custom_components/battery_notes/data/library.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "../../../schema.json",
23
"version": 1,
34
"devices": [
45
{

schema.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"description": "Library of battery types for devices",
66
"type": "object",
77
"properties": {
8+
"$schema": {
9+
"description": "Schema reference",
10+
"type": "string"
11+
},
812
"version": {
913
"description": "Version of the library schema",
1014
"type": "integer"
@@ -21,23 +25,29 @@
2125
],
2226
"properties": {
2327
"manufacturer": {
24-
"type": "string"
28+
"type": "string",
29+
"description": "The manufacturer of the device as it appears in Home Assistant."
2530
},
2631
"model": {
27-
"type": "string"
32+
"type": "string",
33+
"description": "The model of the device as it appears in Home Assistant."
2834
},
2935
"battery_type": {
30-
"type": "string"
36+
"type": "string",
37+
"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."
3138
},
3239
"battery_quantity": {
33-
"type": "integer"
40+
"type": "integer",
41+
"exclusiveMinimum": 1,
42+
"description": "The number of batteries required by the device. If a device only has one battery this property should be omitted."
3443
}
3544
}
3645
}
3746
}
3847
},
3948
"additionalProperties": false,
4049
"required": [
50+
"$schema",
4151
"version",
4252
"devices"
4353
]

0 commit comments

Comments
 (0)