src/Commands/Check.php 1 location
|
@@ 20-27 (lines=8) @@
|
17 |
|
->dereference('file://' . Util::schemaPath('draft4.json')); |
18 |
|
$validator = new Validator($schema, $metaSchema); |
19 |
|
|
20 |
|
if ($validator->passes()) { |
21 |
|
$output->writeln('<info>✓ Valid draft-04 JSON Schema</info>'); |
22 |
|
return 0; |
23 |
|
} else { |
24 |
|
$output->writeln('<error>✗ Invalid draft-04 JSON Schema</error>'); |
25 |
|
Util::renderErrorTable($output, $validator->errors()); |
26 |
|
return 1; |
27 |
|
} |
28 |
|
} |
29 |
|
} |
30 |
|
|
src/Commands/Validate.php 1 location
|
@@ 20-27 (lines=8) @@
|
17 |
|
$schema = Dereferencer::draft4()->dereference($schema); |
18 |
|
$validator = new Validator($data, $schema); |
19 |
|
|
20 |
|
if ($validator->passes()) { |
21 |
|
$output->writeln('<info>✓ Validation passed</info>'); |
22 |
|
return 0; |
23 |
|
} else { |
24 |
|
$output->writeln('<error>✗ Validation failed</error>'); |
25 |
|
Util::renderErrorTable($output, $validator->errors()); |
26 |
|
return 1; |
27 |
|
} |
28 |
|
} |
29 |
|
} |
30 |
|
|