terriajs-schema
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "terriajs-schema", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "JSON schema for TerriaJS.", | ||
@@ -5,0 +5,0 @@ "main": "validateSchema.js", |
@@ -20,2 +20,7 @@ "use strict"; | ||
function validate(filenames) { | ||
function isUsefulError(error) { | ||
// Now the delicate art of trying to guess which errors are meaningful and which are just spam. | ||
// We suppress "meta-errors", assuming that a useful error is deeper in the tree. | ||
return ['allOf','anyOf','not','oneOf'].indexOf(error.name) === -1; | ||
} | ||
var processed = 0, errors = 0, pad = ' '; | ||
@@ -26,9 +31,9 @@ return when.map(when.map(filenames, readFile), function(fileContent, i) { | ||
console.error('FAILED: ' + filenames[i] + ':' ); | ||
result.errors.forEach(function(error) { | ||
// Now the delicate art of trying to guess which errors are meaningful and which are just spam. | ||
// We suppress "meta-errors", assuming that a useful error is deeper in the tree. | ||
if (['allOf','anyOf','not','oneOf'].indexOf(error.name) === -1) { | ||
console.error(pad + error.name + ' ' + error.stack); | ||
console.error(pad + ' Value: ' + JSON.stringify(error.instance).slice(0,160)); | ||
} | ||
var shownErrors = result.errors.filter(isUsefulError); | ||
if (!shownErrors.length) { | ||
shownErrors = result.errors; | ||
} | ||
shownErrors.forEach(function(error) { | ||
console.error(pad + error.name + ' ' + error.stack); | ||
console.error(pad + ' Value: ' + JSON.stringify(error.instance).slice(0,160)); | ||
}); | ||
@@ -85,3 +90,2 @@ errors ++; | ||
argv.version = argv.version || defaultVersion; | ||
schemaPath = argv.schemadir || path.join(schemaBasePath, argv.version); | ||
if (argv.terriajsdir) { | ||
@@ -96,2 +100,3 @@ try { | ||
} | ||
schemaPath = argv.schemadir || path.join(schemaBasePath, argv.version); | ||
argv.quiet || process.stdout.write('Loading schema: ' + path.join(schemaPath, '/Catalog.json ... ')); | ||
@@ -98,0 +103,0 @@ return loadNextSchema('Catalog.json').then(function() { |
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
493457
16577
0