AdonisJS v6 is coming soon. Get early access to the Alpha release.


Validates the value to be equal to a provided value.

import { schema, rules } from '@ioc:Adonis/Core/Validator'
country: schema.string([

If the provided value is computed at runtime and you are using schema caching, then you must make use of refs.

import { schema } from '@ioc:Adonis/Core/Validator'
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
export default class CreateUserValidator {
constructor(protected ctx: HttpContextContract) {}
public refs = schema.refs({
teamsCountry: getTeamCountryFromSomeWhere(),
public schema = schema.create({
country: schema.string([
public cacheKey = this.ctx.routeKey