Skip to content

Commit

Permalink
Init commit of schema validator
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codechimp committed Dec 11, 2023
1 parent 27797f5 commit 44be861
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/json_validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Validate JSONs

on: [push, pull_request]

jobs:
verify-json-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Validate JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: ./schema.json
INPUT_JSONS: custom_components/battery_notes/data/library.json
41 changes: 41 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/andrew-codechimp/HA-Battery-Notes.schema.json",
"title": "Battery Notes Library",
"description": "Library of battery types for devices",
"type": "object",
"properties": {
"version": {
"description": "Version of the library schema",
"type": "integer"
},
"devices": {
"type": "array",
"properties": {
"manufacturer": {
"type": "string"
},
"model": {
"type": "string"
},
"battery_type": {
"type": "string"
},
"battery_quantity": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"manufacturer",
"model",
"battery_type"
]
}
},
"additionalProperties": false,
"required": [
"version",
"devices"
]
}

0 comments on commit 44be861

Please sign in to comment.