-
-
Notifications
You must be signed in to change notification settings - Fork 304
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Proposal: Add domain() validator to Valibot
Summary
Add a built-in domain() validator to Valibot for validating FQDNs and second-level+ domains, with configurable options (Unicode/IDNA, TLD filtering, wildcard, trailing dot, etc.). This covers the common case “validate a domain, not a URL/email/localhost” without having to maintain complex regular expressions.
Prior discussions that were closed:
- PR that attempted to add this feature but was closed without a clear explanation: feat: add domain name action #907
- Issue that was auto-closed due to inactivity: improvement : add domain name validation #894
Please consider adding this validator to core or to an official extensions package.
Problem
Valibot provides email() and url(), but there is no validator specifically for domain names. As a result:
- Consumers fall back to
regex()/pattern(), which is:- hard to maintain and reuse,
- easy to get wrong on edge cases (label length 1–63, overall length, hyphen rules, IDNA/Unicode, TLD constraints, etc.).
url()is too broad when only a bare domain (no scheme/path/port) is needed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request