Package com.networknt.schema
Class AbstractJsonValidator
java.lang.Object
com.networknt.schema.AbstractJsonValidator
- All Implemented Interfaces:
JsonValidator
,JsonSchemaWalker
- Direct Known Subclasses:
AnnotationKeyword.Validator
,NonValidationKeyword.Validator
Base
JsonValidator
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JsonNodePath
private final String
private final SchemaLocation
private final com.fasterxml.jackson.databind.JsonNode
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractJsonValidator
(SchemaLocation schemaLocation, JsonNodePath evaluationPath, Keyword keyword, com.fasterxml.jackson.databind.JsonNode schemaNode) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
collectAnnotations
(ExecutionContext executionContext) Determine if annotations should be reported.protected boolean
collectAnnotations
(ExecutionContext executionContext, String keyword) Determine if annotations should be reported.The evaluation path is the set of keys, starting from the schema root, through which evaluation passes to reach the schema object that produced a specific result.The keyword of the validator.The schema location is the canonical URI of the schema object plus a JSON Pointer fragment indicating the subschema that produced a result.com.fasterxml.jackson.databind.JsonNode
The schema node used to create the validator.protected void
putAnnotation
(ExecutionContext executionContext, Consumer<JsonNodeAnnotation.Builder> customizer) Puts an annotation.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.networknt.schema.JsonValidator
preloadJsonSchema, validate, walk
-
Field Details
-
schemaLocation
-
schemaNode
private final com.fasterxml.jackson.databind.JsonNode schemaNode -
evaluationPath
-
keyword
-
-
Constructor Details
-
AbstractJsonValidator
public AbstractJsonValidator(SchemaLocation schemaLocation, JsonNodePath evaluationPath, Keyword keyword, com.fasterxml.jackson.databind.JsonNode schemaNode) Constructor.- Parameters:
schemaLocation
- the schema locationevaluationPath
- the evaluation pathkeyword
- the keywordschemaNode
- the schema node
-
-
Method Details
-
getSchemaLocation
Description copied from interface:JsonValidator
The schema location is the canonical URI of the schema object plus a JSON Pointer fragment indicating the subschema that produced a result. In contrast with the evaluation path, the schema location MUST NOT include by-reference applicators such as $ref or $dynamicRef.- Specified by:
getSchemaLocation
in interfaceJsonValidator
- Returns:
- the schema location
-
getEvaluationPath
Description copied from interface:JsonValidator
The evaluation path is the set of keys, starting from the schema root, through which evaluation passes to reach the schema object that produced a specific result.- Specified by:
getEvaluationPath
in interfaceJsonValidator
- Returns:
- the evaluation path
-
getKeyword
Description copied from interface:JsonValidator
The keyword of the validator.- Specified by:
getKeyword
in interfaceJsonValidator
- Returns:
- the keyword
-
getSchemaNode
public com.fasterxml.jackson.databind.JsonNode getSchemaNode()The schema node used to create the validator.- Returns:
- the schema node
-
toString
-
collectAnnotations
Determine if annotations should be reported.- Parameters:
executionContext
- the execution context- Returns:
- true if annotations should be reported
-
collectAnnotations
Determine if annotations should be reported.- Parameters:
executionContext
- the execution contextkeyword
- the keyword- Returns:
- true if annotations should be reported
-
putAnnotation
protected void putAnnotation(ExecutionContext executionContext, Consumer<JsonNodeAnnotation.Builder> customizer) Puts an annotation.- Parameters:
executionContext
- the execution contextcustomizer
- to customize the annotation
-