Files
git.stella-ops.org/devops/telemetry/validation/tests/run-schema-tests.sh
2025-12-26 18:11:06 +02:00

20 lines
661 B
Bash

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../../" && pwd)"
if ! command -v python >/dev/null 2>&1; then
echo "python not found" >&2; exit 127; fi
if ! python - <<'PY' >/dev/null 2>&1; then
import jsonschema
PY
then
echo "python jsonschema module not installed" >&2; exit 127; fi
python - <<'PY'
import json, pathlib
from jsonschema import validate
root = pathlib.Path('ops/devops/telemetry/tests')
config = json.loads((root / 'config-valid.json').read_text())
schema = json.loads(pathlib.Path('docs/modules/telemetry/schemas/telemetry-config.schema.json').read_text())
validate(config, schema)
print('telemetry-config schema ok')
PY