ansman/validate.js

Validate an array which could also contain an array

Closed this issue · 1 comments

I was wondering if I could validate an array which may also include an array. For example this is the structure I have:

{
    events: [{
        name,
        speakers: [{
            name
        }]
    }]
}

From the docs I have not been able to find any solution using Validate.JS unless I am missing something?

My idea would be to be able to do something like this or maybe this is already possible somehow?

{
    events: {
        presence: {
            message: 'Add a name of the event',
        },
        **fields**: {
            name: {
                presence: {
                    message: 'Add a name of the event',
                },
            },
            speakers: {
                name: {
                    presence: {
                        message: 'Add a name of the event',
                    },
                },
            }
        }
    }
}