Formify Docs

UUID

Validate UUID identifiers

UUID

The uuid rule checks that a value is a UUID in the standard hyphenated form.

What it checks

A string matching the 8-4-4-4-12 hexadecimal pattern (any version, case-insensitive):

/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i

Config flag

validationSchema: {
  id: { uuid: true },
}

With a custom message:

id: { uuid: "Enter a valid ID" }

V builder

import { V } from "formify-js";

V.uuid()                    // default message
V.uuid("Enter a valid ID")

Default message

Please enter a valid UUID

Things to know

  • Empty values pass unless required: true is also set.
  • Accepts UUIDs of any version (v1–v5); only the shape is checked.

On this page