Skip to content

Validation Operators

Validation operators check that a value conforms to a specific format.

__email__ of **User** is a valid email
__email__ of **User** is not a valid email

Interactive Example

Policy Rule
Test Data (JSON)
__website__ of **Company** is a valid url

Interactive Example

Policy Rule
Test Data (JSON)
__id__ of **Record** is a valid uuid

Interactive Example

Policy Rule
Test Data (JSON)
__phone__ of **Contact** is a valid phone
__phone__ of **Contact** is a valid phone number

Interactive Example

Policy Rule
Test Data (JSON)
__ip__ of **Network** is a valid ip address
__ipv4__ of **Network** is a valid ipv4 address
__ipv6__ of **Network** is a valid ipv6 address
__range__ of **Network** is a valid cidr
__birthday__ of **Person** is a valid date

Interactive Example

Policy Rule
Test Data (JSON)
__start_time__ of **Event** is a valid time
__created_at__ of **Record** is a valid datetime
__timestamp__ of **Log** is a valid iso8601

Interactive Example

Policy Rule
Test Data (JSON)
__payload__ of **Webhook** is a valid json
__blob__ of **Asset** is a valid base64
__color__ of **Theme** is a valid hex color
__version__ of **Package** is a valid semver
__config__ of **Service** is a valid toml
__target__ of **Link** is a valid uri reference
__preview__ of **Link** is a valid data url
__address__ of **Device** is a valid mac address

You can also use has the format or has format with a format name:

__email__ of **User** has the format "email"
__website__ of **Company** has format "url"
Operator Format name Example valid value
is a valid email email user@example.com
is a valid url url https://example.com
is a valid uuid uuid 550e8400-e29b-41d4-a716-446655440000
is a valid phone phone +1-555-123-4567
is a valid phone number phone number +1-555-123-4567
is a valid ip address ip, ip address 192.168.1.10
is a valid ipv4 address ipv4, ipv4 address 192.168.1.10
is a valid ipv6 address ipv6, ipv6 address 2001:db8::1
is a valid cidr cidr 10.0.0.0/24
is a valid date date 2024-01-15
is a valid time time 10:30:00
is a valid datetime datetime 2024-01-15 10:30:00
is a valid iso8601 iso8601 2024-01-15T10:30:00Z
is a valid json json {"ok":true}
is a valid base64 base64 SGVsbG8=
is a valid hex color hex color #ff00aa
is a valid semver semver v1.2.3-preview
is a valid toml toml name = "demo"
is a valid uri reference uri reference /docs/getting-started#intro
is a valid data url data url data:text/plain;base64,SGVsbG8=
is a valid mac address mac address 01:23:45:67:89:ab

All validation operators have a negated form: is not a valid email, is not a valid url, etc.