From be4091a8b1a75a68cf7db95f643fc3e2a939c332 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 16 Oct 2020 12:58:15 +0200 Subject: [PATCH] doc: add preliminary JSONschema of VILLASnode configuration --- doc/config.schema.json | 256 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 doc/config.schema.json diff --git a/doc/config.schema.json b/doc/config.schema.json new file mode 100644 index 000000000..53ce0bcfe --- /dev/null +++ b/doc/config.schema.json @@ -0,0 +1,256 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "http://example.com/example.json", + "type": "object", + "title": "VILLASnode configuration", + "description": "Schema of the VILLASnode configuration file.", + "default": {}, + "required": [ + "nodes" + ], + "properties": { + "hugepages": { + "$id": "#/properties/hugepages", + "type": "integer", + "title": "The hugepages schema", + "description": "An explanation about the purpose of this instance.", + "default": 0, + "examples": [ + 0 + ] + }, + "http": { + "$id": "#/properties/http", + "type": "object", + "title": "The http schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "htdocs": "/usr/share/villas/node/web" + } + ], + "required": [ + "htdocs" + ], + "properties": { + "htdocs": { + "$id": "#/properties/http/properties/htdocs", + "type": "string", + "title": "The htdocs schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "/usr/share/villas/node/web" + ] + } + }, + "additionalProperties": true + }, + "logging": { + "$id": "#/properties/logging", + "type": "object", + "title": "The logging schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "level": "info" + } + ], + "required": [ + "level" + ], + "properties": { + "level": { + "$id": "#/properties/logging/properties/level", + "type": "string", + "title": "The level schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "info" + ] + } + }, + "additionalProperties": true + }, + "nodes": { + "$id": "#/properties/nodes", + "type": "object", + "title": "The nodes schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "patternProperties": { + "[a-z0-9_-]{2,32}": { + "$id": "#/properties/nodes/properties/node", + "type": "object", + "title": "The node schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "required": [ + "type" + ], + "properties": { + "type": { + "$id": "#/properties/nodes/properties/sig/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "" + }, + "in": { + "type": "object", + "properties": { + "vectorize": { + "type": "integer", + "minimum": 1 + }, + "signals": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + + }, + "unit": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "integer", "float", "boolean", "complex" + ] + }, + "init": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "number", + }, + { + "type": "boolean" + }, + { + "type": "object", + "required": ["real", "imag"], + "additionalProperties": false, + "properties": { + "real": { + "type": "number" + }, + "imag": { + "type": "number" + } + } + } + ] + }, + "enabled": { + "type": "boolean", + "default": true + } + } + } + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "type": "integer", + "minimum": 1 + }, + "type": { + "type": "string", + "enum": [ + "integer", "float", "boolean", "complex" + ] + } + } + } + ] + } + } + }, + "out": { + "type": "object", + "properties": { + "vectorize": { + "type": "integer" + } + } + } + }, + "additionalProperties": true + } + }, + "additionalProperties": false + }, + "paths": { + "$id": "#/properties/paths", + "type": "array", + "title": "The paths schema", + "description": "An explanation about the purpose of this instance.", + "default": [], + "additionalItems": false, + "items": { + "$id": "#/properties/paths/items", + "anyOf": [ + { + "$id": "#/properties/paths/items/anyOf/0", + "type": "object", + "title": "The first anyOf schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "required": [ + "in" + ], + "properties": { + "in": { + "$id": "#/properties/paths/items/anyOf/0/properties/in", + "type": "string", + "title": "The in schema", + "description": "An explanation about the purpose of this instance.", + "default": "" + }, + "out": { + "$id": "#/properties/paths/items/anyOf/0/properties/out", + "type": "string", + "title": "The out schema", + "description": "An explanation about the purpose of this instance.", + "default": "" + } + }, + "additionalProperties": true + } + ] + } + }, + "stats": { + "type": "number" + }, + "affinity": { + "type": "integer" + }, + "priority": { + "type": "integer" + }, + "idle_stop": { + "type": "boolean" + }, + "uuid": { + "type": "string", + "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + } + }, + "additionalProperties": false +}