Skip to content

getValidationErrors

Alan Berdinelli edited this page Sep 8, 2020 · 1 revision

Returns an array with all the validation errors produced on the last validation made from a Schemy instance.
It requires that you call the .validate() method first.

const Schemy = require('schemy');

const schema = new Schemy({
    title: {
        type: String,
        required: true
    }
});

schema.validate({});
schema.getValidationErrors(); // => [ 'Missing required property title' ]