From 7203474275dabbfe3eb4183788a9e1dd1eb100d2 Mon Sep 17 00:00:00 2001 From: Frank Verhoeven Date: Mon, 22 Aug 2022 09:31:09 +0200 Subject: [PATCH] fix: Use correct method for valinor error messages (#12) The `body()` method doesn't apply formatting. --- src/Symfony/HttpKernel/Exception/JsonApiProblem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/HttpKernel/Exception/JsonApiProblem.php b/src/Symfony/HttpKernel/Exception/JsonApiProblem.php index b9feffd..c38ef95 100644 --- a/src/Symfony/HttpKernel/Exception/JsonApiProblem.php +++ b/src/Symfony/HttpKernel/Exception/JsonApiProblem.php @@ -50,8 +50,8 @@ public static function fromValinorMappingError( $flattenedMessages = (new MessagesFlattener($mappingError->node()))->errors(); foreach ($flattenedMessages as $message) { - $messageNode = $message->node(); - $errors[\str_replace(\sprintf('.%s', $messageNode->name()), '', $messageNode->path())] = $message->body(); + $node = $message->node(); + $errors[\str_replace(\sprintf('.%s', $node->name()), '', $node->path())] = $message->toString(); } return new self($title, $detail, $statusCode, ['errors' => $errors]);