exframe-document-validator
A wrapper around exframe-request-validator to validate quote and policy documents with flexible, CSP based coverage details.
Usage
const validate = require('exframe-document-validator');
try {
validate(context, configuration, document);
} catch (e) {
console.log(e.validationErrors[0].dataPath);
console.log(e.validationErrors[0].params);
console.log(e.validationSchema);
}
Arguments:
- context object The context object. If the context object contains a log, debug information will be logged there. If not, debug information will not be logged.
- configuration object Contains coverage details and form fields
- coverageDetails object A coverageDetails object containing coverageLimits, coverageOptions and deductibles
- formFields array A collection of formFields objects
- document object The document to be validated