#!/usr/bin/env bash # Validate naming-conventions registry example JSON against token-registry-entry.schema.json. # Uses check-jsonschema when available (pip install check-jsonschema). # # Env: # SCHEMA_STRICT=1 exit 1 if check-jsonschema is missing (default: skip with 0) # set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" SCHEMA="$ROOT/docs/04-configuration/naming-conventions/schemas/token-registry-entry.schema.json" EX_DIR="$ROOT/docs/04-configuration/naming-conventions/examples" if ! command -v check-jsonschema &>/dev/null; then 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)" exit 0 fi if [[ ! -f "$SCHEMA" ]]; then echo "error: missing schema $SCHEMA" >&2 exit 1 fi check-jsonschema --schemafile "$SCHEMA" "$EX_DIR/gru-cusdc-chain138.example.json" check-jsonschema --schemafile "$SCHEMA" "$EX_DIR/gru-cusdc-v2-chain138.example.json" check-jsonschema --schemafile "$SCHEMA" "$EX_DIR/gru-cusdt-chain138.example.json" check-jsonschema --schemafile "$SCHEMA" "$EX_DIR/gru-cusdt-v2-chain138.example.json" check-jsonschema --schemafile "$SCHEMA" "$EX_DIR/utrnf-lending-triad.example.json" check-jsonschema --schemafile "$SCHEMA" "$EX_DIR/utrnf-collateral-placeholder.example.json" echo "OK naming-conventions registry examples (token-registry-entry schema)"