Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ajv-cmd

willfarrell102kMIT0.7.12

Deref, Validate, Transpile, and Test JSON-Schema (.json) files using ajv

json, schema, json-schema, ajv, compiler, transpiler

readme

ajv-cmd

Deref, Validate, Transpile, and Test JSON-Schema (.json) files using ajv.

Setup

$ npm install -D ajv-cmd
$ ajv --help

Based off of ajv-cli.

Examples

Pre-transpile all handler schemas

#!/usr/bin/env bash

function bundle {
  ajv validate ${1} --valid \
    --strict true --coerce-types array --all-errors true --use-defaults empty
  ajv transpile ${1} \
    --strict true --coerce-types array --all-errors true --use-defaults empty \
    -o ${1%.json}.js
}

for file in handlers/*/schema.*.json; do
  if [ ! -n "$(bundle $file | grep ' is valid')" ]; then
    echo "$file failed"
    exit 1
  fi
done