Skip to content

Commit

Permalink
Schema deosrc (#43)
Browse files Browse the repository at this point in the history
* Test json validate

* Try the old validator
  • Loading branch information
andrew-codechimp authored Dec 12, 2023
1 parent 02ab2e9 commit cadc544
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/json_validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 cadc544

Please sign in to comment.