Add basic jsonschema validation

This commit is contained in:
Samuel Lorch 2023-10-09 23:17:17 +02:00
parent 3fefb7ca7c
commit 6850d134fb
7 changed files with 126 additions and 0 deletions

View file

@ -0,0 +1,30 @@
{
"$id": "https://nfsense.net/config.schema.json",
"title": "Config",
"type": "object",
"properties": {
"config_version": {
"type": "number"
},
"firewall": {
"type": ["number","string","boolean","object","array", "null"]
},
"object": {
"type": ["number","string","boolean","object","array", "null"]
},
"network": {
"type": ["number","string","boolean","object","array", "null"]
},
"service": {
"type": ["number","string","boolean","object","array", "null"]
},
"vpn": {
"type": ["number","string","boolean","object","array", "null"]
},
"system": {
"description": "System Settings",
"$ref": "https://nfsense.net/system.schema.json"
}
},
"required": ["config_version", "firewall", "object", "network", "service", "vpn", "system"]
}

View file

@ -0,0 +1,26 @@
{
"$id": "https://nfsense.net/system.schema.json",
"title": "System",
"type": "object",
"properties": {
"users": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"comment": {
"type": "string"
},
"hash": {
"type": "string"
},
"salt": {
"type": "string"
}
},
"required": ["hash", "salt"]
}
}
},
"required": ["users"]
}