@aliceplex/schema
v2.0.2
Published
JavaScript package to validate Alice Plex Schema.
Downloads
2
Readme
@aliceplex/schema
JavaScript package to validate Alice Plex Schema.
For full documentation, check out here.
Install
npm install @aliceplex/schema
Usage
JSON Schema
Current the schemas are written in JSON Schema Draft 7.
They can be found in src/lib/schema. They can also be accessed through the url in $id
.
CLI
> vps -h
usage: Validate Plex Schema [-h] [-v] -t {show,movie,album,artist}
[-f {fast,full}] [--first-error]
files [files ...]
Positional arguments:
files File to be validate
Optional arguments:
-h, --help Show this help message and exit.
-v, --version Show program's version number and exit.
-t {show,movie,album,artist}, --type {show,movie,album,artist}
Validate type
-f {fast,full}, --format {fast,full}
Format type
--first-error Stop at first error
JavaScript Package
import { Schemas, validateSchema } from "@aliceplex/schema";
const yaml = loadYaml("show.yaml"); // Implementation loadYaml yourself
const result = validateSchema(Schemas.Show, yaml);
if (result.valid) {
console.log(result.data);
} else {
console.log(result.errors);
}