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]);