@toa.io/schemas
TypeScript icon, indicating that this package has built-in type declarations

0.24.0-alpha.0 • Public • Published

Toa Schema Validator

Takes your COS, transforms it to JSONSchema and feeds it to Ajv.

Also, slightly transforms validation error objects for no obvious reason.

schema(schema: cos): Schema

Factory for Schema class.

.fit(value)

Returns error if given value doesn't match the schema, null otherwise.

schema(path: string): Schema

Loads schema from a file.

namespace(schemas: cos[]): Namespace

Factory for Namespace class.

namespace(path: string): Namespace

Loads schemas from .cos.yaml files within given directory, setting their missing $id to the file relative path and basename and returns Namespace.

"up" schema references (../) are not supported.

Readme

Keywords

none

Package Sidebar

Install

npm i @toa.io/schemas

Homepage

toa.io

Weekly Downloads

998

Version

0.24.0-alpha.0

License

MIT

Unpacked Size

15 kB

Total Files

25

Last publish

Collaborators

  • agurtovoi