public final class Example1 extends ExampleBase
This shows a basic usage example. The schema used for validation is
here, which conforms to draft v4, which is
the default version. You will notice that a JSON Pointer (#/definitions/mntent
) is used to address a subschema defining a mount entry.
This example uses JsonSchemaFactory.byDefault()
, and uses
JsonSchemaFactory.getJsonSchema(JsonNode)
to create the JsonSchema
instance.
The first sample (here) validates successfully.
The second sample (here) fails to
validate. Please note that the failure occurs at the structural level
(required entry swap
is missing). Validation therefore stops here,
and does not attempt to validate the /
member of the instance, which
is itself invalid.
The third sample (here) fails to validate as well. This time, the problem is with the member values:
options
member of /tmp
is a string, but an array
is expected;/
member is missing the required fstype
member.
Constructor and Description |
---|
Example1() |
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.