Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes missing default validation messages on FileUpload #12928

Merged
merged 2 commits into from
May 24, 2024

Conversation

mariusticha
Copy link

Description

We encountered an unexpected behaviour in our running app after a composer update, so we investigated a little and found the origin in this PR: #12772

The addition of custom validation messages on a FileUpload has broken the default validation messages thrown in a failing rule.

Code Example:

// App\Rules\TestRule.php
public function validate(string $attribute, mixed $value, Closure $fail): void
{
    $fail('default validation message');
}


// TestComponent.php
FileUpload::make('test')
    ->rule(new TestRule)

Current Behaviour

On submit the error message shown says 'App\Rules\TestRule'

image

Expected Behaviour

On submit the error message shown says 'default validation message'

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@aSeriousDeveloper
Copy link
Contributor

aSeriousDeveloper commented May 24, 2024

This change also fixes the validation message that came with #12799.
Currently, the error message given is reverted to Illuminate\Validation\Rules\File.

@danharrin danharrin added the bug Something isn't working label May 24, 2024
@danharrin danharrin added this to the v3 milestone May 24, 2024
@danharrin danharrin merged commit 0e06ba5 into filamentphp:3.x May 24, 2024
5 of 10 checks passed
@danharrin
Copy link
Member

Thanks

@mariusticha mariusticha deleted the validation-messages branch May 27, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants