Files
validate-json-by-json-schem…/action.yml
Renovate Bot 37b85ec524
All checks were successful
renovate/stability-days Updates have met minimum release age requirement
CI / Dry-Run (pull_request) Successful in 13s
chore(deps): update actions/setup-node action to v6
2026-02-05 11:19:40 +00:00

34 lines
946 B
YAML

name: "Validate JSON by JSON Schema"
description: "Validates JSON files using their $schema reference"
author: "Timo Behrendt <t.behrendt@t00n.de>"
inputs:
json-file:
description: "The JSON file to validate"
required: true
runs:
using: "composite"
steps:
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: "latest"
- name: Extract schema
shell: bash
run: |
schema=$(jq -r '.["$schema"]' < ${{ inputs.json-file }})
if [ -n "$schema" ]; then
curl -s $schema > schema.json
else
echo "No schema found"
exit 0
fi
- name: Update the schema to the latest version
shell: bash
run: |
npx ajv-cli migrate -s schema.json -o schema.json
- name: Validate JSON
shell: bash
run: |
npx ajv-cli validate -s schema.json -d ${{ inputs.json-file }} --strict=false