JSON Schema (draft-07) for W3C Customer Experience Digital Data Layer (CEDDL) 1.0
Based on Mikael Kohlmyr's JSON Schema of CEDDL
To test data against the schema:
Or
- open RunKit + npm: ajv
- past the following code in the playground textarea
- fill it
- then "run" (button below the textarea)
- see the result
const Ajv = require('ajv');
const ajv = new Ajv({allErrors: true});
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));
function test(data) {
const valid = validate(data);
if (valid){
console.log('Valid!');
}
else{
console.log('Invalid: ' + ajv.errorsText(validate.errors));
}
}
const schema ={
/* the content of CEDDL Schema */
};
const digitalData = {
/* your digitalData here */
};
const validate = ajv.compile(schema);
test(digitalData);