From ffb35e961b55871ab98a3dd21e54816af98acff1 Mon Sep 17 00:00:00 2001 From: Erayd Date: Thu, 23 Feb 2017 10:15:09 +1300 Subject: [PATCH] Obey CHECK_MODE_EXCEPTIONS when validating schemas --- src/JsonSchema/Constraints/SchemaConstraint.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/JsonSchema/Constraints/SchemaConstraint.php b/src/JsonSchema/Constraints/SchemaConstraint.php index 202b867f..5c59b12b 100644 --- a/src/JsonSchema/Constraints/SchemaConstraint.php +++ b/src/JsonSchema/Constraints/SchemaConstraint.php @@ -72,7 +72,8 @@ public function check(&$element, $schema = null, JsonPointer $path = null, $i = } // validate schema - $validator = new Validator(new Factory($schemaStorage, null, self::CHECK_MODE_TYPE_CAST)); + $checkMode = $this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS) | self::CHECK_MODE_TYPE_CAST; + $validator = new Validator(new Factory($schemaStorage, null, $checkMode)); $validator->validate($validationSchema, $schemaStorage->getSchema($schemaSpec)); if (!$validator->isValid()) { $validationErrors = array_map(function ($error) {