repocrypts / Validator

Client-side javascript validator library ports from Laravel 5.2
MIT License
46 stars 22 forks source link

Some rules always fail if not set in data #50

Open jkuchynka opened 5 months ago

jkuchynka commented 5 months ago

If a rule is not present, required, etc... it should not fail if it's not set in data. FYI, this works as expected for some rules, such as string, array, boolean

There are a lot of rules I've found this problem with such as: integer, date and url, and lots more.

I can submit a PR if anyone else sees this as a valid issue.

rkaw92 commented 2 weeks ago

Hi, if you're here because you're using Validator and finding that it doesn't quite match Laravel's behavior, you're not alone.

Luckily, you can use this totally undocumented feature (that doesn't exist in Laravel's validator AFAIK):

nullable|url

Hope it helps somebody else!