Package com.networknt.schema.keyword
Class AbstractKeywordValidator
java.lang.Object
com.networknt.schema.keyword.AbstractKeywordValidator
- All Implemented Interfaces:
KeywordValidator,Validator,Walker
- Direct Known Subclasses:
BaseKeywordValidator
Abstract
KeywordValidator.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SchemaLocationprotected final com.fasterxml.jackson.databind.JsonNode -
Constructor Summary
ConstructorsConstructorDescriptionAbstractKeywordValidator(Keyword keyword, com.fasterxml.jackson.databind.JsonNode schemaNode, SchemaLocation schemaLocation) Constructor.AbstractKeywordValidator(String keyword, com.fasterxml.jackson.databind.JsonNode schemaNode, SchemaLocation schemaLocation) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancollectAnnotations(ExecutionContext executionContext) Determine if annotations should be reported.protected booleancollectAnnotations(ExecutionContext executionContext, String keyword) Determine if annotations should be reported.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.JsonNodeThe schema node used to create the validator.protected booleanhasAdjacentKeywordInEvaluationPath(ExecutionContext executionContext, String keyword) Determines if the keyword exists adjacent in the evaluation path.protected booleanhasUnevaluatedItemsInEvaluationPath(ExecutionContext executionContext) protected booleanhasUnevaluatedPropertiesInEvaluationPath(ExecutionContext executionContext) protected voidputAnnotation(ExecutionContext executionContext, Consumer<Annotation.Builder> customizer) Puts an annotation.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.networknt.schema.keyword.KeywordValidator
preloadSchema
-
Field Details
-
schemaNode
protected final com.fasterxml.jackson.databind.JsonNode schemaNode -
schemaLocation
-
-
Constructor Details
-
AbstractKeywordValidator
public AbstractKeywordValidator(String keyword, com.fasterxml.jackson.databind.JsonNode schemaNode, SchemaLocation schemaLocation) Constructor.- Parameters:
keyword- the keywordschemaNode- the schema nodeschemaLocation- the schema location
-
AbstractKeywordValidator
public AbstractKeywordValidator(Keyword keyword, com.fasterxml.jackson.databind.JsonNode schemaNode, SchemaLocation schemaLocation) Constructor.- Parameters:
keyword- the keywordschemaNode- the schema nodeschemaLocation- the schema location
-
-
Method Details
-
getSchemaLocation
Description copied from interface:ValidatorThe 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:
getSchemaLocationin interfaceValidator- Returns:
- the schema location
-
getKeyword
Description copied from interface:KeywordValidatorThe keyword of the validator.- Specified by:
getKeywordin interfaceKeywordValidator- 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<Annotation.Builder> customizer) Puts an annotation.- Parameters:
executionContext- the execution contextcustomizer- to customize the annotation
-
hasAdjacentKeywordInEvaluationPath
protected boolean hasAdjacentKeywordInEvaluationPath(ExecutionContext executionContext, String keyword) Determines if the keyword exists adjacent in the evaluation path.This does not check if the keyword exists in the current meta schema as this can be a cross-draft case where the properties keyword is in a Draft 7 schema and the unevaluatedProperties keyword is in an outer Draft 2020-12 schema.
The fact that the validator exists in the evaluation path implies that the keyword was valid in whatever meta schema for that schema it was created for.
- Parameters:
keyword- the keyword to check- Returns:
- true if found
-
hasUnevaluatedItemsInEvaluationPath
-
hasUnevaluatedPropertiesInEvaluationPath
-