Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function validateAgainstSchema(value: any, schema: ISchema, prefix: string): IValidation[] {
const validate = ajv.compile(schema);
if (!validate(value)) {
return convertAjvErrors(validate.errors, ValidationSeverity.ERROR).map(error =>
Object.assign({}, error, { path: [prefix, ...error.path] })
);
}
return [];
}