uuid
The string is a UUID of any version: 550e8400-e29b-41d4-a716-446655440000.
Signature
ts
function uuid(msg?: Message): Action<string>Parameters
| Parameter | Type | Description |
|---|---|---|
msg | Message | Custom error message |
Error codes
| Code | When | Default message |
|---|---|---|
uuid | Not a UUID | Invalid UUID |
You can change the texts: see Messages & i18n.
Example
ts
const Params = object({ id: pipe(string(), uuid()) });See also
- brand — a separate type for IDs