Use dotted paths for fields and * for array or object entries.
var schema = {
users: { required: true, is: 'array', min: 1 },
'users.*': { is: 'object' },
'users.*.email': { required: true, is: 'email' }
}
function handler(state) {
return state.validate(schema, state.req.body.params || {})
}
Messages use concrete paths such as users.0.email. Require the parent and use min when the collection must contain entries.
Next: Custom schemas →