AdonisJS v6 is here. Learn more in our release blog post.

uuid

Enforce the value of field under validation is a valid uuid. You can also optionally enforce a specific uuid version.

import { schema, rules } from '@ioc:Adonis/Core/Validator'
{
id: schema.string([
rules.uuid()
])
}

Following is an example of validating the id to be a uuidv4 string.

{
id: schema.string([
rules.uuid({ version: 4 })
])
}