Collections validation dynamic rules
Hello!
I found some bug in dynamic collections rules.
Target:
I thought that if I write like this
$each: {
Description(model) {
if (model.Title === 7) {
return {
maxLength: maxLength(500),
required,
};
}
return {
maxLength: maxLength(500),
};
},
}
Result:
Then i get this
$each:
$dirty:true
$error:true
$invalid:true
$params:Object
$pending:false
0:
$dirty:true
$error:true
$invalid:true
$params:Object
$pending:false
Description:
$dirty:true
$error:true
$invalid:true
$params:Object
$pending:false
required:false
maxLength: true
But i get this
$each:
$dirty:true
$error:true
$invalid:true
$params:Object
$pending:false
0:
$dirty:true
$error:true
$invalid:true
$params:Object
$pending:false
Description: true **<-- why ?**
explain to me why the function does not return an object ?
And I'm interested too!
Please try to stay away from $each. It is being removed in the new version in favor of context-aware validations. This means, a parent (or any ancestor component that uses Vuelidate), will know about the errors in any nested component, including those generated dynamically in a v-for etc.
Given our limited capacity, we don’t have the required time to work on the old API.
I've just run into this issue https://github.com/vuelidate/vuelidate/issues/676. Some more information about this would be awesome.