2.0.2 • Published 3 years ago

@stremio/stremio-core-validator v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Stremio Core Validator

Build

Stremio JSON Schema Validator for Node.js using stremio-core types

Additional properties that are not part of the schema got removed. Validation functions throws error if the argument does not match the schema.

Build

npm run build

Supported types

  • Manifest
  • ManifestPreview
  • Descriptor
  • DescriptorPreview
  • MetaItem
  • MetaItemPreview
  • Stream
  • Subtitles
  • Video
  • ResourceResponse

Example

MetaItemPreview validation

meta refers to javascript object with valid MetaItemPreview schema

const validator = require('@stremio/stremio-core-validator');
const meta = validator.meta_item_preview({
    id: 'id',
    type: 'type',
    name: 'name'
});

Cathing errors

error refers to Error object with message describing which field is invalid

const validator = require('@stremio/stremio-core-validator');
try {
    const meta = validator.meta_item_preview({
        id: 'id',
        // type: 'type',
        name: 'name'
    });
} catch (error) {
    console.log(error.message);
}
2.0.2

3 years ago

2.0.1

3 years ago

1.0.1

4 years ago

2.0.0

4 years ago

1.0.0

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago