Hey, I am wondering if there is an easy way to filter out certain kinds of errors with json forms or the ajv instance that is passed to json forms? I am currently creating my own instance of ajv and passing it to json forms and tried to do some filtering in that via a compile but it just omitted all the errors instead
// Wrap ajv.compile to include error filtering
const originalCompile = ajv.compile.bind(ajv);
ajv.compile = (schema, _options) => {
const validate = originalCompile(schema, _options);
// Create a new validate function with error filtering
const validateWithFilter = (data) => {
const valid = validate(data);
console.log('data', data)
// Filter errors only if there are errors and assign a new array
if (!valid && validate.errors) {
const filteredErrors = validate.errors.filter(
(error) => error.keyword !== 'required',
);
console.log('filteredErrors', filteredErrors)
validate.errors =
filteredErrors.length > 0 ? filteredErrors : validate.errors;
}
console.log('valid', valid)
return valid;
};
return validateWithFilter;
};