From 73254fbf9f73c6c5d530e41a1bbf4322931f1d9d Mon Sep 17 00:00:00 2001 From: Allen Taylor Date: Tue, 6 Jun 2017 12:58:27 +0200 Subject: [PATCH] Added a more descriptive error message when asserting against a JSON schema to ensure easier debugging --- src/Constraint/JsonValueMatchesSchema.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Constraint/JsonValueMatchesSchema.php b/src/Constraint/JsonValueMatchesSchema.php index 045f5c2..c1d28ef 100644 --- a/src/Constraint/JsonValueMatchesSchema.php +++ b/src/Constraint/JsonValueMatchesSchema.php @@ -70,7 +70,7 @@ protected function additionalFailureDescription($other): string $validator->check($other, $this->schema); return implode("\n", array_map(function ($error) { - return $error['message']; + return sprintf("[%s] %s", $error['property'], $error['message']); }, $validator->getErrors())); }