@Immutable public final class JsonSchema extends Object
This is the class you will use the most often. It is, in essence, a JsonValidator
initialized with a single JSON Schema. Note however that this
class still retains the ability to resolve JSON References.
It has no public constructors: you should use the appropriate methods in
JsonSchemaFactory
to obtain an instance of this class.
Modifier and Type | Method and Description |
---|---|
com.github.fge.jsonschema.report.ProcessingReport |
validate(com.fasterxml.jackson.databind.JsonNode instance)
Validate an instance and return a processing report
|
com.github.fge.jsonschema.report.ProcessingReport |
validateUnchecked(com.fasterxml.jackson.databind.JsonNode instance)
Validate an instance and return a processing report (unchecked version)
|
boolean |
validInstance(com.fasterxml.jackson.databind.JsonNode instance)
Check whether an instance is valid against this schema
|
boolean |
validInstanceUnchecked(com.fasterxml.jackson.databind.JsonNode instance)
Check whether an instance is valid against this schema (unchecked
version)
|
public com.github.fge.jsonschema.report.ProcessingReport validate(com.fasterxml.jackson.databind.JsonNode instance) throws com.github.fge.jsonschema.exceptions.ProcessingException
instance
- the instance to validatecom.github.fge.jsonschema.exceptions.ProcessingException
- a processing error occurred during validationpublic com.github.fge.jsonschema.report.ProcessingReport validateUnchecked(com.fasterxml.jackson.databind.JsonNode instance)
Unchecked validation means that conditions which would normally cause the processing to stop with an exception are instead inserted into the resulting report.
Warning: this means that anomalous events like an unresolvable JSON Reference, or an invalid schema, are masked!
instance
- the instance to validateListProcessingReport
if an exception was
thrown during processing)public boolean validInstance(com.fasterxml.jackson.databind.JsonNode instance) throws com.github.fge.jsonschema.exceptions.ProcessingException
instance
- the instancecom.github.fge.jsonschema.exceptions.ProcessingException
- an error occurred during processingpublic boolean validInstanceUnchecked(com.fasterxml.jackson.databind.JsonNode instance)
The same warnings apply as described in validateUnchecked(JsonNode)
.
instance
- the instance to validateCopyright © 2014. All Rights Reserved.