Skip to content
check-circle

GitHub Action

JSON Validation

v1.0.0 Latest version

JSON Validation

check-circle

JSON Validation

Validates JSON data against a schema

Installation

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

              

- name: JSON Validation

uses: ammarlakis/action-ajv@v1.0.0

Learn more about this action in ammarlakis/action-ajv

Choose a version

Ajv JSON Schema Validator Action

This GitHub action can be used to validate json and yaml files against a JSON Schema.

Inputs

schema

The schema file used for valiation.

data

The data files to be validated. Glob pattern is supported.

Additional options

This action supports most of Ajv options.

Outputs

valid

The result of the validation.

errors

The errors in case the validation failed.

Example usage

name: Validation

on:
  push:
    branches:
      - master

jobs:
  validate-config:
    runs-on: ubuntu-latest
    
    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: validate
      uses: ammarlakis/action-ajv@master
      with:
        schema: schemas/account.schema.json
        data: accounts/*.yml
        allErrors: true