@aliceplex/schema
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

@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);
}

Readme

Keywords

Package Sidebar

Install

npm i @aliceplex/schema

Weekly Downloads

0

Version

2.0.2

License

Apache-2.0

Unpacked Size

83.3 kB

Total Files

26

Last publish

Collaborators

  • joshuaavalon