diff --git a/config.schema.json b/config.schema.json index e7d062b..dbe05fb 100644 --- a/config.schema.json +++ b/config.schema.json @@ -1,51 +1,72 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://raw.githubusercontent.com/kashalls/kromgo/main/config.schema.json", - "additionalProperties": false, - "description": "kromgo configuration file", - "properties": { - "debug": { - "type": "boolean" - }, - "metrics": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "query": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "suffix": { - "type": "string" + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "debug": { + "type": "boolean" + }, + "metrics": { + "items": { + "$ref": "#/$defs/Metric" }, - "colors": { - "type": "array", - "items": { - "type": "object", - "properties": { - "color": { - "type": "string" - }, - "min": { - "type": "integer" - }, - "max": { - "type": "integer" - } - }, - "required": ["color", "min", "max"] - } - } + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "metrics" + ] + }, + "Metric": { + "properties": { + "name": { + "type": "string" }, - "required": ["name", "query"] - } + "query": { + "type": "string" + }, + "prefix": { + "type": "string" + }, + "suffix": { + "type": "string" + }, + "colors": { + "items": { + "$ref": "#/$defs/MetricColor" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "query" + ] }, - "required": ["metrics"] + "MetricColor": { + "properties": { + "color": { + "type": "string" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "color", + "min", + "max" + ] + } } }