com.github.fge.jsonschema.examples
Class Example10
java.lang.Object
com.github.fge.jsonschema.examples.Example10
public final class Example10
- extends Object
Tenth example: registering schemas
link to source code
In this example, we register a custom schema with a given URI, and
initiate the JsonSchema
instance using that URI. This is done by
customizing a LoadingConfiguration
and registering schemas using
LoadingConfigurationBuilder.preloadSchema(String, JsonNode)
.
The only necessary condition for the URI is for it to be an absolute JSON
reference (see JsonRef.isAbsolute()
), and you can register as many
schemas as you want. Here, we register both schemas from Example5
.
You will notice that the scheme for these URIs is xxx
: it does not
matter in the slightest that it is not a supported scheme by default, the
schema is registered all the same.
This also shows that reference resolution still works in such a case,
since the mntent
schema is referred to via a relative URI from the
fstab
schema.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Example10
public Example10()
main
public static void main(String... args)
throws IOException,
ProcessingException
- Throws:
IOException
ProcessingException