customer-data-validators
Validation Scripts for Elevate Security Customer HR/Behaviors Dataset Formats
Prerequisite
Usage
The CLI is self-documented, just execute and it will output the available commands.
Example, to check the tests/2019-10-30-00_58_46.csv
file with person/v1
integration type:
./cli.js check tests/2019-10-30-00_58_46.csv person/v1 # return code = 3 because there are invalid lines and no valid lines
./cli.js check tests/valid.csv person/v1 # return code = 0 because file is valid
Returns codes of the CLI version
- 0: file contains valid rows, and no invalid rows (so, only valid or empty rows)
- 1: no valid rows
- 2: some invalid rows
- 3: 1 and 2
- -1: invalid command
Edit the schema
Update the type-config.yml
. Then run ./cli.js show-config
to generate the new type-config.json
. Commit both files.
As a CLI:
By cloning the source code
git clone git@github.com:ElevateSecurity/customer-data-validators.git
cd customer-data-validators
./cli.js -h check tests/2019-10-30-00_58_46.csv person/v1
If you prefer to install a specific version of the package and run it as a binary
npm install @elevate_security/customer-data-validators
npm link
customer-data-validator -h
If you don't want to install the package up-front and just want to execute the command as a one-off:
npx --package @elevate_security/customer-data-validators customer-data-validator -h
If npx
is not installed: npm install -g npx
In a React application:
npm install @elevatesecurity/customer-data-validators --save
Then
import CustomerDataValidator from '@elevatesecurity/customer-data-validators'
CustomerDataValidator('a,b\n1,2', 'person/v1').then(console.log)
Tests
npm run test