title: "errors":[{"rule":"required","field":"username","message":"required validation failed"}
body: <p>i am trying to validate my user resister form in adonis js by using</p>
  <pre><code>import {schema, rules} from '@ioc:Adonis/Core/Validator';
  </code></pre>
  <p>after register I am getting error of</p>
  <pre><code>{&quot;errors&quot;:[{&quot;rule&quot;:&quot;required&quot;,&quot;field&quot;:&quot;username&quot;,&quot;message&quot;:&quot;required validation failed&quot;},{&quot;rule&quot;:&quot;required&quot;,&quot;field&quot;:&quot;username&quot;,&quot;message&quot;:&quot;required validation failed&quot;},{&quot;rule&quot;:&quot;required&quot;,&quot;field&quot;:&quot;password&quot;,&quot;message&quot;:&quot;required validation failed&quot;},{&quot;rule&quot;:&quot;required&quot;,&quot;field&quot;:&quot;phone&quot;,&quot;message&quot;:&quot;required validation failed&quot;}]}
  </code></pre>
  <p>validation code is</p>
  <pre><code>import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
  import {schema, rules} from '@ioc:Adonis/Core/Validator';
  import user from 'App/Models/User';
  
  
  
  
  
  export default class LoginController{
  
      public async loginShow({view}:HttpContextContract){
          return view.render('backend/login');
  
      }
  
      public async register({request,response,auth}:HttpContextContract){
          const userSchema = schema.create({
              
  
              username: schema.string({trim:true},[rules.required(), rules.unique({table:'users', column:'username', caseInsensitive: true})]),
              email: schema.string({trim:true},[rules.email(), rules.required(), rules.unique({table:'users', column:'email', caseInsensitive: true})]),
              password:  schema.string({},[rules.minLength(6), rules.maxLength(20)]),
              phone: schema.string({},[rules.unique({table:'users', column:'phone'})])
          })
  
          const data = await request.validate({schema: userSchema})
  
          const User = await user.create(data)
  
          await auth.login(User)
  
          return response.redirect('/')
  
      }
  
  
  
      public async registerShow({view}:HttpContextContract){
          return view.render('backend/register');
  
      }
  
      public async login({request,response,auth}:HttpContextContract){
          const {uid, password} = request.only(['uid','password'])
  
          try{
              await auth.attempt(uid,password)
          } catch (error){
              console.log('form','your email or password is incorrect')
  
              return response.redirect().back()
  
          }
          return response.redirect('/')
      }
  }
  </code></pre>
  <p>migration table is given below:</p>
  <pre><code>import BaseSchema from '@ioc:Adonis/Lucid/Schema'
  
  export default class Users extends BaseSchema {
    protected tableName = 'users'
  
    public async up () {
      this.schema.createTable(this.tableName, (table) =&gt; {
        table.increments('id')
        table.string('name',50).nullable()
        table.string('username',50).unique().notNullable()
        table.string('email',100).unique().notNullable()
        table.string('phone',18).unique().nullable()
        table.string('password',50).notNullable()
        table.string('country',30).nullable()
        table.string('city',40).nullable()
        table.string('address_1',40).nullable()
        table.string('address_2',40).nullable()
        table.string('token',40).nullable()
        table.dateTime('token_expiry')
        table.boolean('is_active').defaultTo(false)
        table.timestamps(true,true)
        
      })
    }
  
    public async down () {
      this.schema.dropTable(this.tableName)
    }
  }
  </code></pre>