Skip to content

fix broker validation rule #81

fix broker validation rule

fix broker validation rule #81

name: Validate JSON files
on:
push:
paths:
- '**/*.json'
- '.github/workflows/validate-schemas.yml'
pull_request:
paths:
- '**/*.json'
- '.github/workflows/validate-schemas.yml'
jobs:
json-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Lint JSON files
shell: bash
run: |
set -euo pipefail
mapfile -d '' files < <(find . -type f -name '*.json' -not -path './node_modules/*' -print0)
if [ ${#files[@]} -eq 0 ]; then
echo 'No JSON files to lint.'
exit 0
fi
failed=0
for f in "${files[@]}"; do
if ! jq -e . "$f" >/dev/null 2>&1; then
echo "::error file=$f::Invalid JSON"
# Print jq error details
jq -e . "$f" || true
failed=1
fi
done
if [ $failed -ne 0 ]; then
echo 'JSON lint failed.'
exit 1
fi
echo 'All JSON files are valid.'