Skip to main content

Module validators

Module validators 

Source
Expand description

Format validators for well-known string constraints.

These validators implement the format checking logic used by buf.validate well-known string rules. They are exposed publicly so that generated validation code (from prost-protovalidate-build) can call them directly without reimplementing the validation logic.

Functions§

fieldmask_covers
Returns true if path is covered by candidate under FieldMask path-coverage semantics — either path equals candidate, or candidate is a prefix of path at a path-segment boundary (i.e. path == "{candidate}.{rest}").
is_email
Returns true if s is a valid email address.
is_host_and_port
Returns true if s is a valid host:port pair.
is_hostname
Returns true if s is a valid hostname per RFC 1123.
is_http_header_name
Returns true if s is a valid HTTP header name.
is_http_header_value
Returns true if s is a valid HTTP header value.
is_ip
Returns true if s is a valid IPv4 or IPv6 address.
is_ip_prefix
Returns true if s is a valid IPv4 or IPv6 CIDR prefix (e.g. 192.168.0.0/16).
is_ipv4
Returns true if s is a valid IPv4 address.
is_ipv6
Returns true if s is a valid IPv6 address (including zone IDs).
is_ipv4_prefix
Returns true if s is a valid IPv4 CIDR prefix (e.g. 10.0.0.0/8).
is_ipv6_prefix
Returns true if s is a valid IPv6 CIDR prefix (e.g. 2001:db8::/32).
is_tuuid
Returns true if s is a valid trimmed UUID (32 hex digits, no hyphens).
is_ulid
Returns true if s is a valid ULID (26 Crockford base32 characters).
is_uri
Returns true if s is a valid absolute URI per RFC 3986.
is_uri_ref
Returns true if s is a valid URI reference (absolute or relative) per RFC 3986.
is_uuid
Returns true if s is a valid UUID in 8-4-4-4-12 hex format.