@iqbspecs/validate-json
v0.4.0
Published
Script to validate json data based on a json schema published in iqb-specifications
Keywords
Readme
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-devOr add manually to the package.json and run npm install:
"devDependencies": {
"@iqbspecs/validate-json": "^0.1.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:
- Folder containing of the files. Recursive validation of subfolders is not supported (yet).
- ID of the schema
- (optional) Version .; if not specified, the script expects the version to be a property
versionof 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"
},