Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check

GitHub Action

Validate JSON

0.0.1

Validate JSON

check

Validate JSON

GitHub Action: Validate JSON

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Validate JSON

uses: OrRosenblatt/[email protected]

Learn more about this action in OrRosenblatt/validate-json-action

Choose a version

Github Action: Validate JSON

A GitHub Action that validates JSON files based on a JSON Schema.

This project uses ajv, fast JSON schema validator, to perform the validation.

Usage

Inputs

  • schema: Relative file path under the repository of a JSON schema file to validate the other JSON files with. Default is: './schema.json'.
  • jsons: One or more relative file paths under the repository (seperated by comma) of the JSON files to validate with the schema provided.

Note: schema is required, otherwise default will be used.

Outputs

  • invalid: One or more of relative file paths of the invalid JSON files, found in the repository (seperated by comma).

Example Workflow

An example .github/workflows/validate.yml workflow to run JSON validation on the repository:

name: Validate JSON

on: [pull_request]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
    - uses: OrRosenblatt/validate-json-action@v1
    - with: 
        schema: /path/to/schema.json
        jsons: /path/to/file.json,/path/to/another/file.json

TODOs

  • Initial validation action
  • Github workflow screenshots
  • Support jsons in PRs
  • Support schema & jsons by external reference (from S3/GitHub/etc...)
  • Support delimiter input