|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.github.fge.jsonschema.examples.Example5
public final class Example5
Fifth example: setting a URI namespace; relative URI resolution
This example demonstrates another capability of JsonSchemaFactory
:
the ability to set a URI namespace. This requires to customize the factory,
and therefore go through JsonSchemaFactoryBuilder
again.
In order to set a URI namespace, we must grab a LoadingConfigurationBuilder
, set the namespace, freeze it, and pass it to
the factory builder and then freeze the factory.
The net effect is that all schema loading done by SchemaLoader
will now resolve against this namespace, and this includes arguments to
JsonSchemaFactory.getJsonSchema(String)
.
The schemas are split in two:
The first refers to the second one via the relative URI mntent.json
. This works precisely because a URI namespace has been set: all
URIs are resolved against this namespace.
Files validated, and the validation outputs, are the same as for Example2
.
Constructor Summary | |
---|---|
Example5()
|
Method Summary | |
---|---|
static void |
main(String... args)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Example5()
Method Detail |
---|
public static void main(String... args) throws IOException, ProcessingException
IOException
ProcessingException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |