See: Description
Class | Description |
---|---|
DivisorKeywordValidator |
Abstract validator for the
divisibleBy (draft v3) and multipleOf (draft v4) keywords |
KeywordFactory |
Factory to provide a set of
KeywordValidator instances for a given
schema |
KeywordValidator |
Base class for a schema keyword validator
|
NumericKeywordValidator |
Base class for numeric instances validators
|
PositiveIntegerKeywordValidator |
Base class for all keywords accepting a positive integer as an argument
|
All keyword validators are built via reflection, since they are dependent
on the schema being passed as an argument. Therefore, if you create a
keyword validator of yours, you must provide a constructor with a
single argument of type JsonNode
.
Not only this, but if you do, be sure to pair it with a SyntaxChecker
. The principle is that the
syntax checker checks that the keyword has a correct shape, which means the
keyword validator does not have to check for this. This considerably
simplifies the constructor (you only have to do minimal type checking, if
any).
To create a new validator, you may either extend KeywordValidator
or one of these two
specific subclasses:
NumericKeywordValidator
(used for numeric instance validation),PositiveIntegerKeywordValidator
(used
for keywords which take a positive integer as an argument).Copyright © 2013. All Rights Reserved.