diff --git a/src/Validator/InputValidator.php b/src/Validator/InputValidator.php index 013fd45b..05bc4740 100644 --- a/src/Validator/InputValidator.php +++ b/src/Validator/InputValidator.php @@ -138,6 +138,12 @@ private function buildValidationTree(ValidationNode $rootObject, iterable $field foreach ($fields as $name => $arg) { $property = $arg['name'] ?? $name; + + if (!array_key_exists($property, $inputData)) { + // This field was not provided in the inputData. Do not attempt to validate it. + continue; + } + $config = static::normalizeConfig($arg['validation'] ?? []); if (isset($config['cascade']) && isset($inputData[$property])) {