Validator fails when it should not

Hello everyone,

I’m trying to use a validator in order to not have multiple occurrences of records based on specific rules.

I create a new object model instance, then I set the two values either with merge() or field selector is the same, and then I validate(). If validation doesn’t fail, I can save it to DB.

Here’s the code:

const { validate } = use('Validator')

const report = new RfReport();
report.jobName = jobInstance.name;

const rules = {
    jobName: 'required|unique:rf_reports,jobName'
}

const validation = await validate(report, rules)
console.log('jobName: ' + report.jobName)

if (validation.fails()) {
    console.log(validation.messages())
} else {
    await report.save()
}

Every time I try to validate, it fails with the following message:

jobName: tests
[ { message: 'required validation failed on jobName',
    field: 'jobName',
    validation: 'required' } ]

But it’s impossible. The jobName is printed out as expected.

Any suggestion please?