domain
Creates a domain name validation action.
const Action = v.domain<TInput, TMessage>(message);
Generics
TInputextends stringTMessageextends ErrorMessage<DomainIssue<TInput>> | undefined
Parameters
messageTMessage
Explanation
With domain you can validate the formatting of a domain string.
If the input is not a valid domain, you can use message to customize the error message.
Validates ASCII domains. Limits: 63 chars per label, 253 chars total. Internationalized domain names (IDNs) are not supported, including Punycode-encoded labels. If you need to validate a full URL (including protocol, path, query, etc.), use the
urlaction.
Returns
ActionDomainAction<TInput, TMessage>
Examples
The following examples show how domain can be used.
Domain schema
Schema to validate a domain.
const DomainSchema = v.pipe(
v.string(),
v.nonEmpty('Please enter your domain.'),
v.domain('The domain is badly formatted.')
);
Related
The following APIs can be combined with domain.
Schemas
Methods
Utils
© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/domain/