![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | deployment/ | 2 years ago | - | |
![]() | test/ | 2 years ago | - | |
![]() | user/ | 2 years ago | - | |
![]() | LICENSE | 2 years ago | 1.0K | |
![]() | README.md | 2 years ago | 1.7K | 9b1f1b9 rm old utils [كارل مبارك] |
![]() | package.json | 2 years ago | 729 | 2324c9f added npm start script [كارل مبارك] |
![]() | yarn.lock | 2 years ago | 50K |
The schemas contained within this package are used all across the ZEIT ecosystem to validate config files, requests to APIs and more. It ensures users always send just the right data.
It is important that these schemas stay in sync between projects, so that the validations are always performed in the same way for the same kind of object.
The files located in this repository are .js
and not .json
, because parsing JSON takes a little bit longer.
To get started, pick one of the schemas in this repository and load it:
const schema = require('@zeit/schemas/deployment/config');
Next, set up AJV (the validator) and run the schema through it:
const AJV = require('ajv');
const ajv = new AJV({ allErrors: true });
const isValid = ajv.validate(schema, <object-to-validate>);
if (!isValid) {
console.error(`The following entries are wrong: ${JSON.stringify(ajv.errors)}`);
}
That is all! :tada:
npm link
@zeit/schemas
, just link it to the dependencies: npm link @zeit/schemas
and load it!Leo Lamprecht (@notquiteleo) - ZEIT