Comparing version 6.0.4 to 6.0.5
@@ -7,9 +7,9 @@ { | ||
"border": { | ||
"$ref": "#/definitions/borders" | ||
"$ref": "shared.json#/definitions/borders" | ||
}, | ||
"columns": { | ||
"$ref": "#/definitions/columns" | ||
"$ref": "shared.json#/definitions/columns" | ||
}, | ||
"columnDefault": { | ||
"$ref": "#/definitions/column" | ||
"$ref": "shared.json#/definitions/column" | ||
}, | ||
@@ -20,97 +20,3 @@ "drawHorizontalLine": { | ||
}, | ||
"additionalProperties": false, | ||
"definitions": { | ||
"columns": { | ||
"type": "object", | ||
"patternProperties": { | ||
"^[0-9]+$": { | ||
"$ref": "#/definitions/column" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"column": { | ||
"type": "object", | ||
"properties": { | ||
"alignment": { | ||
"type": "string", | ||
"enum": [ | ||
"left", | ||
"right", | ||
"center" | ||
] | ||
}, | ||
"width": { | ||
"type": "number" | ||
}, | ||
"wrapWord": { | ||
"type": "boolean" | ||
}, | ||
"truncate": { | ||
"type": "number" | ||
}, | ||
"paddingLeft": { | ||
"type": "number" | ||
}, | ||
"paddingRight": { | ||
"type": "number" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"borders": { | ||
"type": "object", | ||
"properties": { | ||
"topBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinJoin": { | ||
"$ref": "#/definitions/border" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"border": { | ||
"type": "string" | ||
} | ||
} | ||
"additionalProperties": false | ||
} |
@@ -7,9 +7,9 @@ { | ||
"border": { | ||
"$ref": "#/definitions/borders" | ||
"$ref": "shared.json#/definitions/borders" | ||
}, | ||
"columns": { | ||
"$ref": "#/definitions/columns" | ||
"$ref": "shared.json#/definitions/columns" | ||
}, | ||
"columnDefault": { | ||
"$ref": "#/definitions/column" | ||
"$ref": "shared.json#/definitions/column" | ||
}, | ||
@@ -20,97 +20,3 @@ "columnCount": { | ||
}, | ||
"additionalProperties": false, | ||
"definitions": { | ||
"columns": { | ||
"type": "object", | ||
"patternProperties": { | ||
"^[0-9]+$": { | ||
"$ref": "#/definitions/column" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"column": { | ||
"type": "object", | ||
"properties": { | ||
"alignment": { | ||
"type": "string", | ||
"enum": [ | ||
"left", | ||
"right", | ||
"center" | ||
] | ||
}, | ||
"width": { | ||
"type": "number" | ||
}, | ||
"wrapWord": { | ||
"type": "boolean" | ||
}, | ||
"truncate": { | ||
"type": "number" | ||
}, | ||
"paddingLeft": { | ||
"type": "number" | ||
}, | ||
"paddingRight": { | ||
"type": "number" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"borders": { | ||
"type": "object", | ||
"properties": { | ||
"topBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinJoin": { | ||
"$ref": "#/definitions/border" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"border": { | ||
"type": "string" | ||
} | ||
} | ||
"additionalProperties": false | ||
} |
@@ -1,754 +0,43 @@ | ||
'use strict'; | ||
var equal = require('ajv/lib/compile/equal'); | ||
var validate = (function() { | ||
var pattern0 = new RegExp('^[0-9]+$'); | ||
var refVal = []; | ||
var refVal1 = (function() { | ||
var pattern0 = new RegExp('^[0-9]+$'); | ||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) { | ||
'use strict'; | ||
var vErrors = null; | ||
var errors = 0; | ||
if (rootData === undefined) rootData = data; | ||
if ((data && typeof data === "object" && !Array.isArray(data))) { | ||
var errs__0 = errors; | ||
var valid1 = true; | ||
for (var key0 in data) { | ||
var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0)); | ||
if (isAdditional0) { | ||
valid1 = false; | ||
var err = { | ||
keyword: 'additionalProperties', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/additionalProperties', | ||
params: { | ||
additionalProperty: '' + key0 + '' | ||
}, | ||
message: 'should NOT have additional properties' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
} | ||
if (data.topBody !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) { | ||
if (vErrors === null) vErrors = refVal2.errors; | ||
else vErrors = vErrors.concat(refVal2.errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.topJoin !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.topLeft !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.topRight !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.bottomBody !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.bottomJoin !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.bottomLeft !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.bottomRight !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.bodyLeft !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.bodyRight !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.bodyJoin !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.joinBody !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.joinLeft !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.joinRight !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.joinJoin !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) { | ||
if (vErrors === null) vErrors = refVal[2].errors; | ||
else vErrors = vErrors.concat(refVal[2].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
} else { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/type', | ||
params: { | ||
type: 'object' | ||
}, | ||
message: 'should be object' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
validate.errors = vErrors; | ||
return errors === 0; | ||
}; | ||
})(); | ||
refVal1.schema = { | ||
"type": "object", | ||
"properties": { | ||
"topBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinJoin": { | ||
"$ref": "#/definitions/border" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}; | ||
refVal1.errors = null; | ||
refVal[1] = refVal1; | ||
var refVal2 = (function() { | ||
var pattern0 = new RegExp('^[0-9]+$'); | ||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) { | ||
'use strict'; | ||
var vErrors = null; | ||
var errors = 0; | ||
if (rootData === undefined) rootData = data; | ||
if (typeof data !== "string") { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/type', | ||
params: { | ||
type: 'string' | ||
}, | ||
message: 'should be string' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
validate.errors = vErrors; | ||
return errors === 0; | ||
}; | ||
})(); | ||
refVal2.schema = { | ||
"type": "string" | ||
}; | ||
refVal2.errors = null; | ||
refVal[2] = refVal2; | ||
var refVal3 = (function() { | ||
var pattern0 = new RegExp('^[0-9]+$'); | ||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) { | ||
'use strict'; | ||
var vErrors = null; | ||
var errors = 0; | ||
if (rootData === undefined) rootData = data; | ||
if ((data && typeof data === "object" && !Array.isArray(data))) { | ||
var errs__0 = errors; | ||
var valid1 = true; | ||
for (var key0 in data) { | ||
var isAdditional0 = !(false || pattern0.test(key0)); | ||
if (isAdditional0) { | ||
valid1 = false; | ||
var err = { | ||
keyword: 'additionalProperties', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/additionalProperties', | ||
params: { | ||
additionalProperty: '' + key0 + '' | ||
}, | ||
message: 'should NOT have additional properties' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
} | ||
for (var key0 in data) { | ||
if (pattern0.test(key0)) { | ||
var errs_1 = errors; | ||
if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) { | ||
if (vErrors === null) vErrors = refVal4.errors; | ||
else vErrors = vErrors.concat(refVal4.errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
} | ||
} else { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/type', | ||
params: { | ||
type: 'object' | ||
}, | ||
message: 'should be object' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
validate.errors = vErrors; | ||
return errors === 0; | ||
}; | ||
})(); | ||
refVal3.schema = { | ||
"type": "object", | ||
"patternProperties": { | ||
"^[0-9]+$": { | ||
"$ref": "#/definitions/column" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}; | ||
refVal3.errors = null; | ||
refVal[3] = refVal3; | ||
var refVal4 = (function() { | ||
var pattern0 = new RegExp('^[0-9]+$'); | ||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) { | ||
'use strict'; | ||
var vErrors = null; | ||
var errors = 0; | ||
if (rootData === undefined) rootData = data; | ||
if ((data && typeof data === "object" && !Array.isArray(data))) { | ||
var errs__0 = errors; | ||
var valid1 = true; | ||
for (var key0 in data) { | ||
var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight'); | ||
if (isAdditional0) { | ||
valid1 = false; | ||
var err = { | ||
keyword: 'additionalProperties', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/additionalProperties', | ||
params: { | ||
additionalProperty: '' + key0 + '' | ||
}, | ||
message: 'should NOT have additional properties' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
} | ||
var data1 = data.alignment; | ||
if (data1 !== undefined) { | ||
var errs_1 = errors; | ||
if (typeof data1 !== "string") { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + '.alignment', | ||
schemaPath: '#/properties/alignment/type', | ||
params: { | ||
type: 'string' | ||
}, | ||
message: 'should be string' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
var schema1 = validate.schema.properties.alignment.enum; | ||
var valid1; | ||
valid1 = false; | ||
for (var i1 = 0; i1 < schema1.length; i1++) | ||
if (equal(data1, schema1[i1])) { | ||
valid1 = true; | ||
break; | ||
} if (!valid1) { | ||
var err = { | ||
keyword: 'enum', | ||
dataPath: (dataPath || '') + '.alignment', | ||
schemaPath: '#/properties/alignment/enum', | ||
params: { | ||
allowedValues: schema1 | ||
}, | ||
message: 'should be equal to one of the allowed values' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.width !== undefined) { | ||
var errs_1 = errors; | ||
if ((typeof data.width !== "number")) { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + '.width', | ||
schemaPath: '#/properties/width/type', | ||
params: { | ||
type: 'number' | ||
}, | ||
message: 'should be number' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.wrapWord !== undefined) { | ||
var errs_1 = errors; | ||
if (typeof data.wrapWord !== "boolean") { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + '.wrapWord', | ||
schemaPath: '#/properties/wrapWord/type', | ||
params: { | ||
type: 'boolean' | ||
}, | ||
message: 'should be boolean' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.truncate !== undefined) { | ||
var errs_1 = errors; | ||
if ((typeof data.truncate !== "number")) { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + '.truncate', | ||
schemaPath: '#/properties/truncate/type', | ||
params: { | ||
type: 'number' | ||
}, | ||
message: 'should be number' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.paddingLeft !== undefined) { | ||
var errs_1 = errors; | ||
if ((typeof data.paddingLeft !== "number")) { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + '.paddingLeft', | ||
schemaPath: '#/properties/paddingLeft/type', | ||
params: { | ||
type: 'number' | ||
}, | ||
message: 'should be number' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.paddingRight !== undefined) { | ||
var errs_1 = errors; | ||
if ((typeof data.paddingRight !== "number")) { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + '.paddingRight', | ||
schemaPath: '#/properties/paddingRight/type', | ||
params: { | ||
type: 'number' | ||
}, | ||
message: 'should be number' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
} else { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/type', | ||
params: { | ||
type: 'object' | ||
}, | ||
message: 'should be object' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
validate.errors = vErrors; | ||
return errors === 0; | ||
}; | ||
})(); | ||
refVal4.schema = { | ||
"type": "object", | ||
"properties": { | ||
"alignment": { | ||
"type": "string", | ||
"enum": ["left", "right", "center"] | ||
}, | ||
"width": { | ||
"type": "number" | ||
}, | ||
"wrapWord": { | ||
"type": "boolean" | ||
}, | ||
"truncate": { | ||
"type": "number" | ||
}, | ||
"paddingLeft": { | ||
"type": "number" | ||
}, | ||
"paddingRight": { | ||
"type": "number" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}; | ||
refVal4.errors = null; | ||
refVal[4] = refVal4; | ||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) { | ||
'use strict'; /*# sourceURL=config.json */ | ||
var vErrors = null; | ||
var errors = 0; | ||
if (rootData === undefined) rootData = data; | ||
if ((data && typeof data === "object" && !Array.isArray(data))) { | ||
var errs__0 = errors; | ||
var valid1 = true; | ||
for (var key0 in data) { | ||
var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'drawHorizontalLine'); | ||
if (isAdditional0) { | ||
valid1 = false; | ||
var err = { | ||
keyword: 'additionalProperties', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/additionalProperties', | ||
params: { | ||
additionalProperty: '' + key0 + '' | ||
}, | ||
message: 'should NOT have additional properties' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
} | ||
if (data.border !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) { | ||
if (vErrors === null) vErrors = refVal1.errors; | ||
else vErrors = vErrors.concat(refVal1.errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.columns !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) { | ||
if (vErrors === null) vErrors = refVal3.errors; | ||
else vErrors = vErrors.concat(refVal3.errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.columnDefault !== undefined) { | ||
var errs_1 = errors; | ||
if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) { | ||
if (vErrors === null) vErrors = refVal[4].errors; | ||
else vErrors = vErrors.concat(refVal[4].errors); | ||
errors = vErrors.length; | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
if (data.drawHorizontalLine !== undefined) { | ||
var errs_1 = errors; | ||
var errs__1 = errors; | ||
var valid1; | ||
valid1 = typeof data.drawHorizontalLine == "function"; | ||
if (!valid1) { | ||
if (errs__1 == errors) { | ||
var err = { | ||
keyword: 'typeof', | ||
dataPath: (dataPath || '') + '.drawHorizontalLine', | ||
schemaPath: '#/properties/drawHorizontalLine/typeof', | ||
params: { | ||
keyword: 'typeof' | ||
}, | ||
message: 'should pass "typeof" keyword validation' | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} else { | ||
for (var i1 = errs__1; i1 < errors; i1++) { | ||
var ruleErr1 = vErrors[i1]; | ||
if (ruleErr1.dataPath === undefined) ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine'; | ||
if (ruleErr1.schemaPath === undefined) { | ||
ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof"; | ||
} | ||
} | ||
} | ||
} | ||
var valid1 = errors === errs_1; | ||
} | ||
} else { | ||
var err = { | ||
keyword: 'type', | ||
dataPath: (dataPath || '') + "", | ||
schemaPath: '#/type', | ||
params: { | ||
type: 'object' | ||
}, | ||
message: 'should be object' | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _validators = _interopRequireDefault(require("../dist/validators")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// eslint-disable-next-line import/default | ||
/** | ||
* @param {string} schemaId | ||
* @param {formatData~config} config | ||
* @returns {undefined} | ||
*/ | ||
const validateConfig = (schemaId, config = {}) => { | ||
const validate = _validators.default[schemaId]; | ||
if (!validate(config)) { | ||
const errors = validate.errors.map(error => { | ||
return { | ||
dataPath: error.dataPath, | ||
message: error.message, | ||
params: error.params, | ||
schemaPath: error.schemaPath | ||
}; | ||
if (vErrors === null) vErrors = [err]; | ||
else vErrors.push(err); | ||
errors++; | ||
} | ||
validate.errors = vErrors; | ||
return errors === 0; | ||
}; | ||
})(); | ||
validate.schema = { | ||
"$id": "config.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": { | ||
"border": { | ||
"$ref": "#/definitions/borders" | ||
}, | ||
"columns": { | ||
"$ref": "#/definitions/columns" | ||
}, | ||
"columnDefault": { | ||
"$ref": "#/definitions/column" | ||
}, | ||
"drawHorizontalLine": { | ||
"typeof": "function" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"definitions": { | ||
"columns": { | ||
"type": "object", | ||
"patternProperties": { | ||
"^[0-9]+$": { | ||
"$ref": "#/definitions/column" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"column": { | ||
"type": "object", | ||
"properties": { | ||
"alignment": { | ||
"type": "string", | ||
"enum": ["left", "right", "center"] | ||
}, | ||
"width": { | ||
"type": "number" | ||
}, | ||
"wrapWord": { | ||
"type": "boolean" | ||
}, | ||
"truncate": { | ||
"type": "number" | ||
}, | ||
"paddingLeft": { | ||
"type": "number" | ||
}, | ||
"paddingRight": { | ||
"type": "number" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"borders": { | ||
"type": "object", | ||
"properties": { | ||
"topBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"topRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bottomRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"bodyJoin": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinBody": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinLeft": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinRight": { | ||
"$ref": "#/definitions/border" | ||
}, | ||
"joinJoin": { | ||
"$ref": "#/definitions/border" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"border": { | ||
"type": "string" | ||
} | ||
}); | ||
/* eslint-disable no-console */ | ||
console.log('config', config); | ||
console.log('errors', errors); | ||
/* eslint-enable no-console */ | ||
throw new Error('Invalid config.'); | ||
} | ||
}; | ||
validate.errors = null; | ||
module.exports = validate; | ||
var _default = validateConfig; | ||
exports.default = _default; | ||
//# sourceMappingURL=validateConfig.js.map |
@@ -8,3 +8,3 @@ { | ||
"dependencies": { | ||
"ajv": "^6.12.4", | ||
"ajv": "^7.0.0-rc.0", | ||
"lodash": "^4.17.20", | ||
@@ -22,4 +22,4 @@ "slice-ansi": "^4.0.0", | ||
"@babel/register": "^7.10.5", | ||
"ajv-cli": "^3.2.1", | ||
"ajv-keywords": "^3.5.2", | ||
"ajv-cli": "^4.0.0-rc.0", | ||
"ajv-keywords": "^4.0.0-beta.3", | ||
"babel-plugin-istanbul": "^6.0.0", | ||
@@ -37,2 +37,3 @@ "babel-plugin-lodash": "^3.3.4", | ||
"husky": "^4.2.5", | ||
"js-beautify": "^1.13.0", | ||
"mocha": "^8.1.3", | ||
@@ -82,7 +83,7 @@ "nyc": "^15.1.0", | ||
"create-readme": "gitdown ./.README/README.md --output-file ./README.md", | ||
"create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -c ajv-keywords/keywords/typeof -o dist/validateConfig.js && ajv compile --all-errors --inline-refs=false -s src/schemas/streamConfig -c ajv-keywords/keywords/typeof -o dist/validateStreamConfig.js", | ||
"create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -s src/schemas/streamConfig -r src/schemas/shared -c ajv-keywords/dist/keywords/typeof -o | js-beautify > dist/validators.js", | ||
"lint": "npm run build && eslint ./src ./test && flow", | ||
"test": "mocha --require @babel/register" | ||
}, | ||
"version": "6.0.4" | ||
"version": "6.0.5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79
196729
25
2740
1
+ Addedajv@7.2.4(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
- Removedajv@6.12.6(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
Updatedajv@^7.0.0-rc.0