Skip to content
Alan Berdinelli edited this page Feb 13, 2024 · 9 revisions

You can just define the schema within the parent object:

Added in v1.5.0

const personSchema = new Schemy({
    name: {
        firstname: { type: String },
        lastname: { type: String },
        required: true
    }
});

You can also take advantage of the short schema declaration:

Added in v1.5.3

const personSchema = new Schemy({
    name: {
        firstname: String,
        lastname: String
    }
};

Note: Keep in mind that using the short format, the property will be required by default.

Clone this wiki locally