Skip to content

Commit

Permalink
fix: Use correct method for valinor error messages (#12)
Browse files Browse the repository at this point in the history
The `body()` method doesn't apply formatting.
  • Loading branch information
frankverhoeven authored Aug 22, 2022
1 parent 8820723 commit 7203474
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/HttpKernel/Exception/JsonApiProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 7203474

Please sign in to comment.