3.3.1 โ€ข Published 3 months ago

schemy v3.3.1

Weekly downloads
205
License
MIT
Repository
github
Last release
3 months ago

Docs ๐Ÿ“– ยท Plugins ๐Ÿงฉ ยท Changelog ๐Ÿ“ ยท Donate ๐Ÿ’ฐ

Schemy is an extremely simple, lightweight yet powerful schema validation library. Perfect for lightweight-oriented projects like cloud functions where size and speed are key features. It weights less than 18 KB!

Usage

Install using npm: npm install --save schemy. Then, create a schema with the desired properties and their types:

const Schemy = require('schemy');

const characterSchema = new Schemy({
    'name': {
        type: String,
        required: true
    }
});

// Validate against input data
if (!characterSchema.validate(someData)) {
    characterSchema.getValidationErrors(); // => [ 'Missing required property name' ]
}

// You can also validate asynchronously
await Schemy.validate(someData, characterSchema);

Plugins

Schemy can be easily extended with new functionality. For example, this adds a feature to reference properties within the schema.

// Require the plugin
const ReferenceSupport = require('schemy-reference-support');

// Call Schemy.extend() with the plugin or with an array of plugins
Schemy.extend(ReferenceSupport);

new Schemy({
    password: String,
    confirm: Schemy.$ref('password')
});

You can check the whole list of available plugins in the wiki โ†—

API

Static methods

Instance methods

Full documentation โ†—๏ธ

3.3.1

3 months ago

3.3.0

8 months ago

3.2.4

2 years ago

3.2.3

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.6

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.5

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.11.0

3 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago