Skip to content

iqb-specifications/validate-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT npm

This script validates json data files using json schema. It will use a schema file published in iqb-specifications.github.io.

Install

npm install @iqbspecs/validate-json --save-dev

Or add manually to the package.json and run npm install:

    "devDependencies": {
      "@iqbspecs/validate-json": "^1.0.0"
    }

Sure the version of the package will change...

Usage

To use it, define a new script in package.json:

    "scripts": {
      "validate": "validate-json test-data response 1.4"
    },

Parameters:

  1. Folder containing of the files. Recursive validation of subfolders is not supported (yet).
  2. ID of the schema
  3. (optional) Version .; if not specified, the script expects the version to be a property version of the data file

Validation of a local Json Schema

To help authoring of data specifications, there is another script. Call test-schema to validate a local schema with local data files. Parameters:

  • <test-data-folder>: Folder containing the json files used to validate. Default: ./test
  • <schema-file>: File to get validated. If no filename is given, the first file '*.schema.json' found in the project root will be taken.
    "scripts": {
      "check-schema": "test-schema ./test/sonderweg ./schemas/sonderweg.schema.json"
    },

About

Script to validate json data based on a json schema published in iqb-specifications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors