@Immutable public final class JsonValidator extends Object
One such instance exists per JsonSchemaFactory
. In fact, you have
to go through a factory to obtain an instance.
This class is also responsible for building JsonSchema
instances.
JsonSchemaFactory.getValidator()
Modifier and Type | Method and Description |
---|---|
ProcessingReport |
validate(JsonNode schema,
JsonNode instance)
Validate a schema/instance pair, "fast" version
|
ProcessingReport |
validate(JsonNode schema,
JsonNode instance,
boolean deepCheck)
Validate a schema/instance pair
|
ProcessingReport |
validateUnchecked(JsonNode schema,
JsonNode instance)
Validate a schema/instance pair (unchecked mode), "fast" version
|
ProcessingReport |
validateUnchecked(JsonNode schema,
JsonNode instance,
boolean deepCheck)
Validate a schema/instance pair (unchecked mode)
|
public ProcessingReport validate(JsonNode schema, JsonNode instance, boolean deepCheck) throws ProcessingException
The third boolean argument instructs the validator as to whether it should validate children even if the container (array or object) fails to validate.
schema
- the schemainstance
- the instancedeepCheck
- see descriptionProcessingException
- an exception occurred during validationNullPointerException
- the schema or instance is nullpublic ProcessingReport validate(JsonNode schema, JsonNode instance) throws ProcessingException
This calls validate(JsonNode, JsonNode, boolean)
with false
as the third argument.
schema
- the schemainstance
- the instanceProcessingException
- an exception occurred during validationNullPointerException
- the schema or instance is nullpublic ProcessingReport validateUnchecked(JsonNode schema, JsonNode instance, boolean deepCheck)
The third boolean argument instructs the validator as to whether it should validate children even if the container (array or object) fails to validate.
The same warnings as described in JsonSchema.validateUnchecked(JsonNode)
apply
schema
- the schemainstance
- the instancedeepCheck
- see descriptionNullPointerException
- the schema or instance is nullpublic ProcessingReport validateUnchecked(JsonNode schema, JsonNode instance)
This calls validateUnchecked(JsonNode, JsonNode, boolean)
with false
as a third argument.
The same warnings as described in JsonSchema.validateUnchecked(JsonNode)
apply
schema
- the schemainstance
- the instanceNullPointerException
- the schema or instance is null