Skip to content

Commit

Permalink
Merge pull request #1 from Memcrab/validation_nested_object
Browse files Browse the repository at this point in the history
fix validation nested object
  • Loading branch information
oleksandr-diudiun authored May 18, 2023
2 parents 7918fc9 + a00dd08 commit eeba4d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static function customFormat(ValidationError $error): array
$formattedMessage = $formatter->formatErrorMessage($error);

if (isset($error->data()->fullPath()[0])) $formattedMessage = "Validation error on `" . $error->data()->fullPath()[0] . "`. " . $formattedMessage;
if (isset($error->data()->fullPath()[0])) $formattedMessage = $formattedMessage . ". But `" . $error->data()->value() . "` given." . "`. ";
if (isset($error->data()->fullPath()[0]) && !is_object($error->data()->value())) $formattedMessage = $formattedMessage . ". But `" . $error->data()->value() . "` given." . "`. ";

return [
'properties' => $error->schema()->info()->data(),
Expand Down

0 comments on commit eeba4d6

Please sign in to comment.