public final class Example4 extends ExampleBase
This demonstrates three capabilities of JsonSchemaFactory:
$schema (as in
Example2).The implementation provides a resource scheme which allows to load
JSON from files in the classpath. It is strictly equivalent to calling Class.getResourceAsStream(String). The URI used is resource:/org/eel/kitchen/jsonschema/examples/fstab-sub.json. Because we
want to validate against the fstab subschema, we use JsonSchemaFactory.fromURI(String, String) to load the actual schema, with
the second argument being JSON Pointer /fstab. Note that unlike
methods which load schemas directly from JSON, this method and other similar
methods can throw JsonSchemaException.
Since the root schema declares $schema to be draft v4, the set of
validators used will be validators defined for draft v4 (instead of the
default draft v3).
Files validated, and the validation outputs, are the same as for Example2.
| Constructor and Description |
|---|
Example4() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String... args) |
loadResource, printReportpublic static void main(String... args) throws IOException, JsonSchemaException
IOExceptionJsonSchemaExceptionCopyright © 2013. All Rights Reserved.