diff --git a/src/tools/json-schema-validate.rb b/src/tools/json-schema-validate.rb new file mode 100755 index 000000000..1ac933fa2 --- /dev/null +++ b/src/tools/json-schema-validate.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +require 'json' +require 'jschema' + +fail "Required parameters: " if ARGV.count != 2 + +content = JSON.parse File.read(ARGV[1]) +schema_data = JSON.parse File.read(ARGV[0]) +schema = JSchema.build(schema_data) +errors = schema.validate content + +exit 0 if errors.empty? + +puts errors.join("\n") + +exit 1