vlucas/valitron

Required fields on nested values ["vlucas/valitron": "1.1.7"]

Cerwym opened this issue · 1 comments

Using the following payload;

{
    "requirements": {
    	"meta": {},
    	"selected": {},
    	"package_type": "PKG_001"
    }
}

The following rule

$validator = new Validator($data);
$validator->rule('required', ['requirements', 'requirements.meta', 'requirements.package_type']);

returns

Array
(
    [requirements.meta] => Array
        (
            [0] => Requirements.meta is required
        )

    [requirements.package_type] => Array
        (
            [0] => Requirements.package Type is required
        )

)

Is this a valid bug or incorrect usage?

Closing. I can see that I'm using an older version, after updating this is fixed.