From 3de2b0e39a1660271c540f7c6304a8f598a151a6 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Fri, 3 Oct 2025 17:47:14 +0200 Subject: [PATCH] docs --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 753c426..d7d7d33 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ -# validate-json-by-json-schema-action +# Validate JSON by JSON Schema Action -A GitHub Action to automatically validate JSON files using their $schema reference. \ No newline at end of file +A GitHub Action that automatically validates JSON files using their `$schema` reference. The action extracts the schema URL from the JSON file, downloads it, migrates it to the latest version, and validates the JSON against the schema. + +## Usage + +```yaml +- name: Validate JSON file + uses: your-username/validate-json-by-json-schema-action@v1 + with: + json-file: "path/to/your/file.json" +``` + +## Inputs + +| Input | Description | Required | Default | +| ----------- | ------------------------- | -------- | ------- | +| `json-file` | The JSON file to validate | Yes | - | + +## How it works + +1. Extracts the `$schema` URL from the specified JSON file +2. Downloads the schema from the URL +3. Migrates the schema to the latest version using `ajv-cli` +4. Validates the JSON file against the schema +5. Exits successfully if validation passes, fails if validation fails + +## Requirements + +- The JSON file must contain a `$schema` property with a valid URL +- The schema URL must be accessible via HTTP/HTTPS +- The action uses `ajv-cli` for validation with `--strict=false` mode