Skip to content

Commit

Permalink
Obey CHECK_MODE_EXCEPTIONS when validating schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
erayd committed Feb 22, 2017
1 parent 7a279bf commit ffb35e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/JsonSchema/Constraints/SchemaConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ffb35e9

Please sign in to comment.