| Interface | Description |
|---|---|
| SyntaxChecker |
Interface implemented by all syntax checkers
|
| Class | Description |
|---|---|
| ArrayChildrenSyntaxChecker |
Dedicated syntax validator checker for keywords having arrays as arguments
|
| DependenciesSyntaxChecker |
Syntax checker for the
dependencies keyword |
| DivisibleBySyntaxChecker |
Syntax checker for the
divisibleBy keyword |
| EnumSyntaxChecker |
Syntax validator for the
enum keyword |
| ExclusiveMaximumSyntaxChecker |
Syntax validator for the
exclusiveMaximum keyword |
| ExclusiveMinimumSyntaxChecker |
Syntax validator for the
exclusiveMinimum keyword |
| ExtendsSyntaxChecker |
Syntax validator for the
extends keyword |
| ItemsSyntaxChecker |
Syntax validator for the
items keyword |
| PatternPropertiesSyntaxChecker |
Syntax validator for the
patternProperties keyword |
| PatternSyntaxChecker |
Syntax validator for the
pattern keyword |
| PositiveIntegerSyntaxChecker |
Syntax validator for keywords having a positive integer value as an argument
|
| PropertiesSyntaxChecker |
Syntax validator for the
properties keyword |
| SimpleSyntaxChecker |
Simple type-only syntax checker
|
| SyntaxValidator |
Schema syntax validator
|
| TypeKeywordSyntaxChecker |
Dedicated syntax checker for
type and disallow |
| URISyntaxChecker |
The main class in this package is SyntaxValidator.
Syntax validation has a critically important role in the validation process. An invalid schema will always fail to invalidate a JSON instance.
For this implementation in particular, it also helps to ensure that the
KeywordValidator associated with
the schema keyword does not need to preoccupy about its arguments being
well-formed -- they will be since the syntax validator has verified that they
are.
Unlike keyword validators, syntax validators are not built by reflection. It is therefore your responsibility to instantiate it and only then register it.
Here is an example code for a hypothetic foo keyword which must
have a string as an argument, and this string must be at least 5 characters
long:
public final class SyntaxCheckerImpl
implements SyntaxChecker
{
@Override
public void checkSyntax(final List<String> messages,
final JsonNode schema)
{
final JsonNode node = schema.get("foo");
if (!node.isTextual()) {
messages.add("field is not a string");
return;
}
if (node.textValue().length() < 5)
messages.add("field has insufficient length");
}
}
For more information, see SyntaxChecker.
Copyright © 2012. All Rights Reserved.