initial
Some checks failed
CI / Dry-Run (pull_request) Failing after 14s
CI / Test (pull_request) Failing after 17s

This commit is contained in:
2025-10-03 13:50:59 +02:00
parent 651ea6648e
commit 8f77f6b1f5
7 changed files with 9065 additions and 0 deletions

31
action.yml Normal file
View File

@@ -0,0 +1,31 @@
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:
- name: Extract schema
shell: bash
run: |
// use jq to extract the $schema property from the json-file
schema=$(jq -r '.["$schema"]' < ${{ inputs.json-file }})
// if it's there, we fetch the schema from the URL
if [ -n "$schema" ]; then
curl -s $schema > schema.json
else
exit 0
fi
- name: Update the schema to the latest version
shell: bash
run: |
npx ajv migrate -i schema.json -o schema.json
- name: Validate JSON
shell: bash
run: |
npx ajv validate -s schema.json -d ${{ inputs.json-file }}