Can I check for previously generated validation errors, while validating the custom keyword?
This is the best I could come up with so far:
ajv.addKeyword('fromInput',{
modifying:true,
compile: function (schema, parentSchema, it){
return function () {
// console.log(it)
return true;
}
},
errors: true
});
Please note that I used the option to define "compile:" fn only because this option allows the "it" context, so from there I can access "it" or "it.self".
To be clear, and also to confirm that I interpreting this feature correctly (?), I placed the custom keyword as very last in the schema, so I assume that at validation time all previous keywords will be validated and errors generated.
So during validation of this custom keyword, I need to access those validation errors and make some decisions based on that.
However, I don't know where to go from here (see above code), because in the debugger I don't see any errors.
it.self
does have an "errors" property, but it's =null
.