2.0.2 • Published 5 years ago

@aliceplex/schema v2.0.2

Weekly downloads
8
License
Apache-2.0
Repository
gitlab
Last release
5 years ago

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

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-rc1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

1.0.0-rc2

5 years ago

1.0.0-rc1

5 years ago