diff --git a/src/Validator/DocumentValidator.php b/src/Validator/DocumentValidator.php index 3efd992..201a850 100644 --- a/src/Validator/DocumentValidator.php +++ b/src/Validator/DocumentValidator.php @@ -86,6 +86,12 @@ class DocumentValidator if (null === $rules) { $rules = static::allRules(); } + + if (true === is_array($rules) && 0 === count($rules)) { + // Skip validation if there are no rules + return []; + } + $typeInfo = $typeInfo ?: new TypeInfo($schema); $errors = static::visitUsingRules($schema, $typeInfo, $ast, $rules); return $errors;