Class ArrayTypeValidator
java.lang.Object
org.forgerock.json.schema.validator.validators.Validator
org.forgerock.json.schema.validator.validators.ArrayTypeValidator
- All Implemented Interfaces:
SimpleValidator<Object>
ArrayTypeValidator applies all the constraints of a
array type.
Sample JSON Schema:
{
"type" : "array",
"required" : true,
"uniqueItems" : "true",
"minItems" : 2,
"maxItems" : 3,
"additionalItems" : {
"type" : "string",
"enum" : [
"test1",
"test2",
"test3"
]
},
"items" : {
"type" : "string"
}
}
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcollectAllValidators(Collection<Validator> results) Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.voidvalidate(Object node, JsonPointer at, ErrorHandler handler) Validates thenodevalue against the embedded schema object.Methods inherited from class org.forgerock.json.schema.validator.validators.Validator
collectAllValidators, collectAllValidators, getJsonPointer, getPath, isRequired, newList, resolveSchemaReferences, toString
-
Constructor Details
-
ArrayTypeValidator
Default ctor.- Parameters:
schema- the schema holding the reference to this validatorjsonPointer- the JSON pointer locating where this validator was defined in the schema.
-
-
Method Details
-
validate
Validates thenodevalue against the embedded schema object.The selected error handler defines the behaviour of the validator. The
FailFastErrorHandlerthrows exception at firs violation. Other customisedErrorHandlercan collect all exceptions and after the validation the examination of thehandlercontains the final result.- Parameters:
node- value to validateat- JSONPath of the node. null means it's the root nodehandler- customised error handler likeFailFastErrorHandler
-
collectAllValidators
Collects all the sub-validators held in this validator and aggregates them in the passed in Collection.- Overrides:
collectAllValidatorsin classValidator- Parameters:
results- where collected validators are aggregated
-