validate using jsonschema, not manually

This commit is contained in:
Emi Vasilek 2023-11-06 05:18:39 +01:00
parent a2cbbb2068
commit 2f183c758f
4 changed files with 125 additions and 70 deletions

31
schemas/units.json Normal file
View file

@ -0,0 +1,31 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/units.json",
"title": "Units",
"description": "Units",
"type": "array",
"items": {
"type": "object",
"required": [ "name" ],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"conversions": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [ "to", "ratio" ],
"properties": {
"to": { "type": "string" },
"ratio": { "type": "integer" }
}
}
},
"aliases": {
"type": "array",
"items": { "type": "string" }
}
}
}
}