Sha256: 5a134aacfe58608414d4e01d0c39ecff60c82e46ce75219a26553896498bed9e
Contents?: true
Size: 532 Bytes
Versions: 42
Compression:
Stored size: 532 Bytes
Contents
<?php require __DIR__ . '/../vendor/autoload.php'; $data = json_decode(file_get_contents('data.json')); // Validate $validator = new JsonSchema\Validator(); $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json'))); if ($validator->isValid()) { echo "The supplied JSON validates against the schema.\n"; } else { echo "JSON does not validate. Violations:\n"; foreach ($validator->getErrors() as $error) { echo sprintf("[%s] %s\n", $error['property'], $error['message']); } }
Version data entries
42 entries across 42 versions & 1 rubygems