public final class Example6 extends Object
In this example, the same schema file is used as in Example1. This
time, though, it is assumed that the base URI used for addressing this schema
is http://my.site/schemas/fstab.json#. But instead of trying to
fetch it from the web directly, we want to use the local copy, which is
located under URI resource:/org/eel/kitchen/jsonschema/examples/fstab.json#.
The solution here is to build a custom URITranslatorConfiguration,
which allows to customize URI handling; in this case, a schema redirection
using the URITranslatorConfigurationBuilder.addSchemaRedirect(String,
String). We then inject this into a custom LoadingConfiguration.
The effect is that if you required a schema via URI http://my.site/schemas/fstab.json#, it will silently transform this URI into
resource:/org/eel/kitchen/jsonschema/examples/fstab.json#
internally.
Note that URIs must be absolute JSON references (see JsonRef).
| Constructor and Description |
|---|
Example6() |
public static void main(String... args) throws IOException, ProcessingException
IOExceptionProcessingException