Skip to content

Required

Alan Berdinelli edited this page Nov 24, 2020 · 2 revisions

All properties in Schemy are optional, unless you specify otherwise.

const Schema = require('schemy');

const Example = new Schema({
    data: {
        type: String,
        required: true
    }
});

You can also specify your property as required, and validate the type as well in a simplified way:

const Schema = require('schemy');

const Example = new Schema({
    data: String
});

Clone this wiki locally