com.github.fge.jsonschema.examples
Class Example4

java.lang.Object
  extended by com.github.fge.jsonschema.examples.ExampleBase
      extended by com.github.fge.jsonschema.examples.Example4

public final class Example4
extends ExampleBase

Fourth example: schema loading via URIs, and subschema addressing

link to source code

link to schema

This demonstrates two capabilities of JsonSchemaFactory:

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.getJsonSchema(String) to load the actual schema; the URI used as an argument also has a JSON Pointer as a fragment.

Files validated, and the validation outputs, are the same as for Example2.


Constructor Summary
Example4()
           
 
Method Summary
static void main(String... args)
           
 
Methods inherited from class com.github.fge.jsonschema.examples.ExampleBase
loadResource, printReport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Example4

public Example4()
Method Detail

main

public static void main(String... args)
                 throws IOException,
                        ProcessingException
Throws:
IOException
ProcessingException


Copyright © 2014. All Rights Reserved.