From 321e2e837f98ce75d1dcee503ac69791d4aa3c70 Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Thu, 30 May 2024 20:22:07 +0200 Subject: [PATCH] new: added config schema (#277) --- etc/defaults/config-ecs.yaml | 2 + etc/defaults/config-k8s.yaml | 2 + etc/defaults/config.yaml | 2 + schema/json/config.json | 289 +++++++++++++++++++++++++++++++++++ 4 files changed, 295 insertions(+) create mode 100644 schema/json/config.json diff --git a/etc/defaults/config-ecs.yaml b/etc/defaults/config-ecs.yaml index 4ce68f20..8b54f7b1 100644 --- a/etc/defaults/config-ecs.yaml +++ b/etc/defaults/config-ecs.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/pamburus/hl/master/schema/json/config.json + # Settings for fields processing. fields: # Configuration of the predefined set of fields. diff --git a/etc/defaults/config-k8s.yaml b/etc/defaults/config-k8s.yaml index c9839f17..8908d868 100644 --- a/etc/defaults/config-k8s.yaml +++ b/etc/defaults/config-k8s.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/pamburus/hl/master/schema/json/config.json + # Settings for fields processing. fields: # Configuration of the predefined set of fields. diff --git a/etc/defaults/config.yaml b/etc/defaults/config.yaml index 2d60ce5b..40a51556 100644 --- a/etc/defaults/config.yaml +++ b/etc/defaults/config.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/pamburus/hl/master/schema/json/config.json + # Time format, see https://man7.org/linux/man-pages/man1/date.1.html for details. time-format: '%b %d %T.%3N' diff --git a/schema/json/config.json b/schema/json/config.json new file mode 100644 index 00000000..24bf301d --- /dev/null +++ b/schema/json/config.json @@ -0,0 +1,289 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "time-format": { + "type": "string" + }, + "time-zone": { + "type": "string" + }, + "fields": { + "type": "object", + "additionalProperties": false, + "properties": { + "predefined": { + "type": "object", + "additionalProperties": false, + "properties": { + "time": { + "type": "object", + "additionalProperties": false, + "properties": { + "show": { + "type": "string" + }, + "names": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "names" + ] + }, + "logger": { + "type": "object", + "additionalProperties": false, + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "names" + ] + }, + "level": { + "type": "object", + "additionalProperties": false, + "properties": { + "show": { + "type": "string" + }, + "variants": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + }, + "values": { + "type": "object", + "additionalProperties": false, + "properties": { + "debug": { + "type": "array", + "items": { + "type": [ + "string", + "integer" + ] + } + }, + "info": { + "type": "array", + "items": { + "type": [ + "string", + "integer" + ] + } + }, + "warning": { + "type": "array", + "items": { + "type": [ + "string", + "integer" + ] + } + }, + "error": { + "type": "array", + "items": { + "type": [ + "string", + "integer" + ] + } + } + } + }, + "level": { + "type": "string", + "enum": [ + "debug", + "info", + "warning", + "error" + ] + } + }, + "required": [ + "names" + ] + } + } + }, + "required": [ + "variants" + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "names" + ] + }, + "caller": { + "type": "object", + "additionalProperties": false, + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "names" + ] + }, + "caller-file": { + "type": "object", + "additionalProperties": false, + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "names" + ] + }, + "caller-line": { + "type": "object", + "additionalProperties": false, + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "names" + ] + } + } + }, + "ignore": { + "type": "array", + "items": [ + { + "type": "string" + } + ] + }, + "hide": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "formatting": { + "type": "object", + "additionalProperties": false, + "properties": { + "flatten": { + "type": "string", + "enum": [ + "never", + "always" + ] + }, + "punctuation": { + "type": "object", + "additionalProperties": false, + "properties": { + "logger-name-separator": { + "type": "string" + }, + "field-key-value-separator": { + "type": "string" + }, + "string-opening-quote": { + "type": "string" + }, + "string-closing-quote": { + "type": "string" + }, + "source-location-separator": { + "type": "string" + }, + "hidden-fields-indicator": { + "type": "string" + }, + "level-left-separator": { + "type": "string" + }, + "level-right-separator": { + "type": "string" + }, + "input-number-prefix": { + "type": "string" + }, + "input-number-left-separator": { + "type": "string" + }, + "input-number-right-separator": { + "type": "string" + }, + "input-name-left-separator": { + "type": "string" + }, + "input-name-right-separator": { + "type": "string" + }, + "input-name-clipping": { + "type": "string" + }, + "input-name-common-part": { + "type": "string" + }, + "array-separator": { + "type": "string" + } + } + } + } + }, + "concurrency": { + "type": [ + "integer", + "null" + ] + }, + "theme": { + "type": "string" + } + } +} \ No newline at end of file