Skip to main content

IsIpOrURL

Summary

Property decorator that validates whether the value is a valid IPv4/IPv6 address or a fully qualified domain name (URL).

Signature

Parameters

validationOptions

Type:ValidationOptions Optional: Yes Optional class-validator validation options.

isIPOptions

Type:Parameters<typeof isIP>[1] Optional: Yes Optional options for validation.

isURLOptions

Type:Parameters<typeof isURL>[1] Optional: Yes Optional options for validation.

Returns

Type:(object: object, propertyName: string) => void Property decorator that validates whether the value is a valid IPv4/IPv6 address or a fully qualified domain name (URL).

Remarks

Built on top of class-validator’s isIP and isURL helpers. Use on config properties that represent server hostnames or addresses.

Examples

Example 1