{"id":16006528,"url":"https://github.com/dsanders11/json-schema-validate-action","last_synced_at":"2025-07-23T19:03:41.645Z","repository":{"id":214583946,"uuid":"736581212","full_name":"dsanders11/json-schema-validate-action","owner":"dsanders11","description":"GitHub Action which validates YAML/JSON files against a JSON schema","archived":false,"fork":false,"pushed_at":"2025-07-04T09:56:13.000Z","size":2222,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-09T21:55:23.221Z","etag":null,"topics":["github-actions","json-schema"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dsanders11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-28T09:43:43.000Z","updated_at":"2025-07-04T09:56:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"5573d1ac-e8f3-4c0b-8b45-791efd9203d3","html_url":"https://github.com/dsanders11/json-schema-validate-action","commit_stats":null,"previous_names":["dsanders11/json-schema-validate-action"],"tags_count":9,"template":false,"template_full_name":"dsanders11/typescript-action","purl":"pkg:github/dsanders11/json-schema-validate-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsanders11%2Fjson-schema-validate-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsanders11%2Fjson-schema-validate-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsanders11%2Fjson-schema-validate-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsanders11%2Fjson-schema-validate-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsanders11","download_url":"https://codeload.github.com/dsanders11/json-schema-validate-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsanders11%2Fjson-schema-validate-action/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264505348,"owners_count":23618926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","json-schema"],"created_at":"2024-10-08T11:42:05.220Z","updated_at":"2025-07-23T19:03:41.638Z","avatar_url":"https://github.com/dsanders11.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Schema Validate Action\n\n[![GitHub Super-Linter](https://github.com/dsanders11/json-schema-validate-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)\n[![CI](https://github.com/dsanders11/json-schema-validate-action/actions/workflows/ci.yml/badge.svg)](https://github.com/dsanders11/json-schema-validate-action/actions/workflows/ci.yml)\n\n\u003e GitHub Action which validates YAML/JSON files against a JSON schema\n\n## Usage\n\n### Example\n\n```yaml\njobs:\n  validate-github-actions-workflows:\n    name: Validate GitHub Actions workflows\n    permissions:\n      contents: read\n    runs-on: ubuntu-latest\n    steps:\n      - name: Check for any changed workflows\n        id: check-for-changed-workflows\n        run: |\n          CHANGED_WORKFLOWS=$(gh api repos/${{ github.event.pull_request.base.repo.full_name }}/pulls/${{ github.event.pull_request.number }}/files --jq '.[] | select((.filename | match(\"^.github/workflows/.*.yml$\")) and (.status != \"removed\")) | .filename')\n          if [[ -n \"$CHANGED_WORKFLOWS\" ]]; then\n            echo \"any_changed=true\" \u003e\u003e $GITHUB_OUTPUT\n          else\n            echo \"any_changed=false\" \u003e\u003e $GITHUB_OUTPUT\n          fi\n      - name: Validate workflows\n        if: steps.check-for-changed-workflows.outputs.any_changed == 'true'\n        uses: dsanders11/json-schema-validate-action@v1.4.0\n        with:\n          schema: https://json.schemastore.org/github-workflow.json\n          files: .github/workflows/**.yml\n```\n\n### Example with Custom Error Messages\n\nWhen `custom-errors` is enabled, you can use the `errorMessage` keyword in your\nJSON schema to provide more user-friendly error messages. This is powered by the\n[ajv-errors](https://github.com/ajv-validator/ajv-errors) library.\n\n```yaml\njobs:\n  validate-config:\n    name: Validate configuration files\n    runs-on: ubuntu-latest\n    steps:\n      - name: Validate config with custom errors\n        uses: dsanders11/json-schema-validate-action@v1.4.0\n        with:\n          schema: ./config.schema.json\n          files: ./config/*.yml\n          custom-errors: true\n```\n\nExample schema with custom error messages:\n\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": {\n      \"type\": \"string\",\n      \"minLength\": 1\n    },\n    \"version\": {\n      \"type\": \"string\",\n      \"pattern\": \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$\"\n    }\n  },\n  \"required\": [\"name\", \"version\"],\n  \"errorMessage\": {\n    \"type\": \"Configuration must be an object\",\n    \"required\": {\n      \"name\": \"Configuration must have a 'name' property\",\n      \"version\": \"Configuration must have a 'version' property\"\n    },\n    \"properties\": {\n      \"name\": \"Name must be a non-empty string\",\n      \"version\": \"Version must follow semantic versioning (e.g., '1.0.0')\"\n    }\n  }\n}\n```\n\n### Validating Schema\n\nSchemas can be validated by setting the `schema` input to the string literal\n`json-schema`.\n\n### Remote Schema Cache Busting\n\nBy default the action will cache remote schemas (this can be disabled via the\n`cache-remote-schema` input). If you need to bust this cache for any reason,\nsimply set a URL fragment (e.g. `#bust-cache`) on the schema URL.\n\n### Inputs\n\n- `schema` - **(required)** URL or file path to JSON schema to validate against\n- `files` - **(required)** Multiline input of file paths to validate - supports\n  globs\n- `fail-on-invalid` - Whether or not to set action failure if a file is invalid\n  (default: `true`)\n- `cache-remote-schema` - Whether or not to cache the schema if remote (default:\n  `true`)\n- `all-errors` - Whether to report all errors or stop after the first (default:\n  `false`)\n- `custom-errors` - Enable support for custom error messages using ajv-errors\n  (default: `false`)\n\n### Outputs\n\n- `valid` - `true` if all files are valid, otherwise `false`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsanders11%2Fjson-schema-validate-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsanders11%2Fjson-schema-validate-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsanders11%2Fjson-schema-validate-action/lists"}