UNPKG

@openactive/data-model-validator

Version:

A library to allow a developer to validate a JSON document against the OpenActive Modelling Opportunity Specification

52 lines (41 loc) 909 B
const ValidationErrorMessage = require('./validation-error-message'); const ValidationError = class { constructor(data) { this.data = data; if ( ( typeof (this.data.message) === 'undefined' || this.data.message === null ) && typeof (this.data.type) !== 'undefined' && typeof (ValidationErrorMessage[this.data.type]) !== 'undefined' ) { this.data.message = ValidationErrorMessage[this.data.type]; } } get category() { return this.data.category; } get type() { return this.data.type; } get message() { return this.data.message; } get severity() { return this.data.severity; } get rule() { return this.data.rule; } set path(path) { this.data.path = path; } get path() { return this.data.path; } get value() { return this.data.value; } }; module.exports = ValidationError;