public final class Example6 extends ExampleBase
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 is here again to build a custom LoadingConfiguration
,
which allows to add schema redirections (using LoadingConfigurationBuilder.addSchemaRedirect(String, String)
. This method
can be called for as many schemas as you wish to redirect.
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() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String... args) |
loadResource, printReport
public static void main(String... args) throws IOException, com.github.fge.jsonschema.exceptions.ProcessingException
IOException
com.github.fge.jsonschema.exceptions.ProcessingException
Copyright © 2014. All Rights Reserved.