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

feat(rules): add url validator #3253

Merged
merged 2 commits into from
Apr 7, 2021

Conversation

davidguilherme
Copy link
Contributor

🔎 Overview

The url validator is really common validator which makes sense to bring it back, as discussed here.

Even though the issue suggests the usage of RFC 3986 regexp. I believe using URL constructor will be more aligned with HTML5 specification [1] [2]

Usage:

<Field name="url" type="url" rules="url" />
<Field name="secure_url" type="url" rules="{ url: /https:\/\/.*/ }" />

Issues affected
closes #3104

@davidguilherme
Copy link
Contributor Author

@logaretm I am not quite sure how you normally translate the messages for new rules. Can you advise me if I should only update the en locale or I need to update all locales on this PR?

@logaretm
Copy link
Owner

logaretm commented Apr 6, 2021

@logaretm I am not quite sure how you normally translate the messages for new rules. Can you advise me if I should only update the en locale or I need to update all locales on this PR?

I would add a message for the en and any languages I could speak well, and leave the rest to the community

packages/rules/src/url.ts Outdated Show resolved Hide resolved
@logaretm logaretm merged commit 1fad5bb into logaretm:main Apr 7, 2021
@logaretm
Copy link
Owner

logaretm commented Apr 7, 2021

Much appreciated again, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v4] Introduce "url" validator in @vee-validate/rules
2 participants