From 2f0d3663b6e599308ce5428f621828945f0adbe4 Mon Sep 17 00:00:00 2001 From: Pat Long Date: Wed, 7 Sep 2016 12:24:20 -0700 Subject: [PATCH] allow null value when field is not required --- src/Jsv4/Validator.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Jsv4/Validator.php b/src/Jsv4/Validator.php index 76bfed9..a75882b 100644 --- a/src/Jsv4/Validator.php +++ b/src/Jsv4/Validator.php @@ -176,6 +176,9 @@ private function includeSubResult($subResult, $dataPrefix, $schemaPrefix) private function checkTypes() { + if (empty($this->schema->required) && is_null($this->data)) { + return; + } if (isset($this->schema->type)) { $types = $this->schema->type; if (!is_array($types)) {