Skip to content

uuid ​

Validates that a field contains a valid UUID (versions 3, 4, and 5).

Options ​

OptionTypeDefaultDescription
version3 | 4 | 5all versionsRestrict to a specific UUID version
messagestringlocale defaultCustom error message

Playground ​

Valid values ​

ValueNotes
"550e8400-e29b-41d4-a716-446655440000"Valid UUID v4
"f47ac10b-58cc-4372-a567-0e02b2c3d479"Valid UUID v4

Invalid values ​

ValueReason
"not-a-uuid"Wrong format
"550e8400-e29b-61d4-a716-446655440000"Version digit 6 is not valid (only versions 3, 4, and 5 are supported)

Notes ​

  • Empty string ("") always returns valid: true. Combine with notEmpty to require a value.
  • Without version option, UUID versions 3, 4, and 5 are accepted.

Released under the MIT License.