Feat(jsonschema): simplify isRequired, look into default and defaultText

This commit is contained in:
Johannes Kirschbauer
2025-06-04 19:53:22 +02:00
parent 13ab73873f
commit dad55040ba
4 changed files with 441 additions and 457 deletions

View File

@@ -1,40 +1,33 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$exportedModuleInfo": { "path": [] },
"type": "object",
"additionalProperties": false,
"required": ["services", "userModules"],
"properties": {
"name": {
"$exportedModuleInfo": { "path": ["name"] },
"type": "string",
"default": "John Doe",
"description": "The name of the user"
},
"age": {
"$exportedModuleInfo": { "path": ["age"] },
"type": "integer",
"default": 42,
"description": "The age of the user"
},
"isAdmin": {
"$exportedModuleInfo": { "path": ["isAdmin"] },
"type": "boolean",
"default": false,
"description": "Is the user an admin?"
},
"kernelModules": {
"$exportedModuleInfo": { "path": ["kernelModules"] },
"type": "array",
"items": {
"$exportedModuleInfo": { "path": ["kernelModules"] },
"type": "string"
},
"default": ["nvme", "xhci_pci", "ahci"],
"description": "A list of enabled kernel modules"
},
"userIds": {
"$exportedModuleInfo": { "path": ["userIds"] },
"type": "object",
"default": {
"horst": 1,
@@ -42,23 +35,17 @@
"albrecht": 3
},
"additionalProperties": {
"$exportedModuleInfo": { "path": ["userIds"] },
"type": "integer"
},
"description": "Some attributes"
},
"userModules": {
"$exportedModuleInfo": { "path": ["userModules"] },
"type": "object",
"additionalProperties": {
"$exportedModuleInfo": { "path": ["userModules", "<name>"] },
"additionalProperties": false,
"type": "object",
"properties": {
"foo": {
"$exportedModuleInfo": {
"path": ["userModules", "<name>", "foo"]
},
"type": [
"boolean",
"integer",
@@ -74,55 +61,44 @@
}
},
"colour": {
"$exportedModuleInfo": { "path": ["colour"] },
"default": "red",
"description": "The colour of the user",
"enum": ["red", "blue", "green"]
},
"services": {
"$exportedModuleInfo": { "path": ["services"] },
"type": "object",
"additionalProperties": false,
"properties": {
"opt": {
"$exportedModuleInfo": { "path": ["services", "opt"] },
"type": "string",
"default": "foo",
"description": "A submodule option"
}
}
},
"required": []
},
"programs": {
"$exportedModuleInfo": { "path": ["programs"] },
"type": "object",
"additionalProperties": false,
"properties": {
"opt": {
"$exportedModuleInfo": { "path": ["programs", "opt"] },
"type": "string",
"default": "bar",
"description": "Another submodule option"
}
},
"required": [],
"default": {}
},
"destinations": {
"$exportedModuleInfo": { "path": ["destinations"] },
"additionalProperties": {
"$exportedModuleInfo": { "path": ["destinations", "<name>"] },
"properties": {
"name": {
"$exportedModuleInfo": {
"path": ["destinations", "<name>", "name"]
},
"default": "name",
"description": "the name of the backup job",
"type": "string"
},
"repo": {
"$exportedModuleInfo": {
"path": ["destinations", "<name>", "repo"]
},
"description": "the borgbackup repository to backup to",
"type": "string"
}