Skip to content

Commit

Permalink
Test json validate
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codechimp committed Dec 12, 2023
1 parent 67e15e2 commit 9884293
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/json_validate.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Validate JSONs

on:
workflow_dispatch:
push:
paths:
- 'custom_components/battery_notes/data/**'
Expand Down
1 change: 1 addition & 0 deletions custom_components/battery_notes/data/library.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "../../../schema.json",
"version": 1,
"devices": [
{
Expand Down
18 changes: 14 additions & 4 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -21,23 +25,29 @@
],
"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."
}
}
}
}
},
"additionalProperties": false,
"required": [
"$schema",
"version",
"devices"
]
Expand Down

0 comments on commit 9884293

Please sign in to comment.