import edvConfig from './schemas/edv-config.json' ; import Ajv from 'ajv' ; const ajv = new Ajv ( { verbose : true , removeAdditional : false } ) ; ajv . addSchema ( edvConfig , 'edvConfig' ) ; export function validateSchema ( { payload } ) { const valid = ajv . validate ( 'edvConfig' , payload ) ; if ( valid ) { return true ; } const error = new Error ( 'Validation error.' ) ; error . errors = ajv . errors ; throw error ; }