Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from Superbalist/switch-to-error-arrays
Browse files Browse the repository at this point in the history
Switch to just use the json serializable array of schema errors
  • Loading branch information
BradWhittington authored Sep 14, 2017
2 parents 4d9c20c + 678b2b9 commit 28ca107
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.0.3 - 2017-07-20

* JSONValidator should just pass the json serializable validation result through

## 4.0.2 - 2017-07-20

* Fix events not being validated correctly when attribute injectors are used
Expand Down Expand Up @@ -35,4 +39,4 @@

## 1.0.0 - 2017-01-27

* Initial release
* Initial release
6 changes: 1 addition & 5 deletions src/Validators/JSONSchemaEventValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ public function validate(EventInterface $event)
if ($schemaValidator->passes()) {
return new ValidationResult($this, $event, true);
} else {
$errors = [];
foreach ($schemaValidator->errors() as $error) {
/* @var ValidationError $error */
$errors[] = $error->getMessage();
}
$errors = $schemaValidator->errors();
return new ValidationResult($this, $event, false, $errors);
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Validators/JSONSchemaEventValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public function testValidateWhenJsonIsInvalid()
$this->assertFalse($result->passes());
$this->assertTrue($result->fails());
$this->assertEquals(
['Required properties missing: ["user"]'],
$result->errors()
'Required properties missing: ["user"]',
$result->errors()[0]->getMessage()
);
}

Expand Down

0 comments on commit 28ca107

Please sign in to comment.