Files
proxmox/scripts/validation/validate-jvmtm-regulatory-closure-schemas.sh
defiQUG dbd517b279 Sync workspace: config, docs, scripts, CI, operator rules, and submodule pointers.
- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains
- Omit embedded publish git dirs and empty placeholders from index

Made-with: Cursor
2026-04-12 06:12:20 -07:00

56 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Validate JVMTM / regulatory closure example JSON against local schemas (draft 2020-12).
# Uses check-jsonschema when available; SCHEMA_STRICT=1 fails if missing.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
BASE="$ROOT/config/jvmtm-regulatory-closure"
SCHEMA="$BASE/schemas"
EX="$BASE/examples"
HAVE_CHECK_JSONSCHEMA=1
if ! command -v check-jsonschema &>/dev/null; then
HAVE_CHECK_JSONSCHEMA=0
if [[ "${SCHEMA_STRICT:-0}" == "1" ]]; then
echo "error: check-jsonschema not found; pip install check-jsonschema" >&2
exit 1
fi
echo "skip: check-jsonschema not installed (pip install check-jsonschema)"
fi
validate_pair() {
local schema_file="$1" example_file="$2"
check-jsonschema --schemafile "$schema_file" "$example_file"
}
if [[ "$HAVE_CHECK_JSONSCHEMA" == "1" ]]; then
validate_pair "$SCHEMA/daily-3way-reconciliation-report.schema.json" "$EX/daily-3way-reconciliation-report.example.json"
validate_pair "$SCHEMA/three-way-reconciliation-result.schema.json" "$EX/three-way-reconciliation-result.example.json"
validate_pair "$SCHEMA/prefunding-proof.schema.json" "$EX/prefunding-proof.example.json"
validate_pair "$SCHEMA/pre-settlement-ack.schema.json" "$EX/pre-settlement-ack.example.json"
validate_pair "$SCHEMA/sample-exception-event.schema.json" "$EX/sample-exception-event.example.json"
validate_pair "$SCHEMA/kyt-screening-result.schema.json" "$EX/kyt-screening-result.example.json"
validate_pair "$SCHEMA/recovery-time-report.schema.json" "$EX/recovery-time-report.example.json"
validate_pair "$SCHEMA/dr-simulation-report.schema.json" "$EX/dr-simulation-report.example.json"
validate_pair "$SCHEMA/real-time-balance-snapshot.schema.json" "$EX/real-time-balance-snapshot.example.json"
validate_pair "$SCHEMA/transaction-compliance-execution.schema.json" "$EX/transaction-compliance-execution.example.json"
validate_pair "$SCHEMA/transaction-compliance-execution.schema.json" "$EX/transaction-compliance-execution.blocked.example.json"
fi
if ! command -v python3 &>/dev/null; then
echo "error: python3 not found; required for JVMTM transaction-grade pack validation" >&2
exit 1
fi
python3 "$ROOT/scripts/validation/validate-jvmtm-transaction-compliance-pack.py"
if [[ -f "$ROOT/config/compliance-matrix/global-compliance-matrix-index.json" ]]; then
python3 "$ROOT/scripts/validation/validate-global-compliance-matrix-index.py"
fi
if [[ "$HAVE_CHECK_JSONSCHEMA" == "1" ]]; then
echo "OK jvmtm-regulatory-closure schema validation (11 example/schema pairs + transaction-grade pack checks)"
else
echo "OK jvmtm-regulatory-closure transaction-grade pack validation (schema checks skipped: check-jsonschema not installed)"
fi